1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_OFFLINE_PAGES_RESOURCE_LOADING_OBSERVER_H_
6 #define CHROME_BROWSER_OFFLINE_PAGES_RESOURCE_LOADING_OBSERVER_H_
7 
8 #include <stdint.h>
9 
10 namespace offline_pages {
11 
12 // This interface is used by clients who want to be notified when a resource is
13 // requested or completes loading, and to report the size of the resource.
14 class ResourceLoadingObserver {
15  public:
16   enum ResourceDataType {
17     IMAGE,
18     TEXT_CSS,
19     XHR,
20     OTHER,
21     RESOURCE_DATA_TYPE_COUNT,
22   };
23 
24   // Report when a resource starts or completes loading.
25   virtual void ObserveResourceLoading(ResourceDataType type, bool started) = 0;
26 
27   // Report how many bytes were received for a resource.
28   virtual void OnNetworkBytesChanged(int64_t received_bytes) = 0;
29 };
30 
31 }  // namespace offline_pages
32 
33 #endif  // CHROME_BROWSER_OFFLINE_PAGES_RESOURCE_LOADING_OBSERVER_H_
34