OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ |
| 6 #define CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "components/data_use_measurement/core/data_use_ascriber.h" |
| 10 #include "url/gurl.h" |
| 11 |
| 12 namespace content { |
| 13 class NavigationHandle; |
| 14 class RenderFrameHost; |
| 15 } |
| 16 |
| 17 namespace data_use_measurement { |
| 18 |
| 19 // Browser implementation of DataUseAscriber. Maintains a list of |
| 20 // DataUseRecorder instances, one for each source of data, such as a page |
| 21 // load. |
| 22 // |
| 23 // A page includes all resources loaded in response to a main page navigation. |
| 24 // The scope of a page load ends either when the tab is closed or a new page |
| 25 // load is initiated by clicking on a link, entering a new URL, window location |
| 26 // change, etc. |
| 27 // |
| 28 // For URLRequests initiated outside the context of a page load, such as |
| 29 // Service Workers, Chrome Services, etc, a new instance of DataUseRecorder |
| 30 // will be created for each URLRequest. |
| 31 // |
| 32 // Each page load will be associated with an instance of DataUseRecorder. |
| 33 // Each URLRequest initiated in the context of a page load will be mapped to |
| 34 // the DataUseRecorder instance for page load. |
| 35 // |
| 36 // This class lives entirely on the IO thread. It maintains a copy of frame and |
| 37 // navigation information on the IO thread. |
| 38 class ChromeDataUseAscriber : public DataUseAscriber { |
| 39 public: |
| 40 ChromeDataUseAscriber(); |
| 41 |
| 42 ~ChromeDataUseAscriber() override; |
| 43 |
| 44 // DataUseAscriber: |
| 45 DataUseRecorder* GetDataUseRecorder(const net::URLRequest* request) override; |
| 46 |
| 47 // Called when a render frame host is created. |
| 48 void RenderFrameCreated(int render_process_id, |
| 49 int render_frame_id, |
| 50 int parent_render_process_id, |
| 51 int parent_render_frame_id); |
| 52 |
| 53 // Called when a render frame host is deleted. |
| 54 void RenderFrameDeleted(int render_process_id, |
| 55 int render_frame_id, |
| 56 int parent_render_process_id, |
| 57 int parent_render_frame_id); |
| 58 |
| 59 // Called when a main frame navigation is started. |
| 60 void DidStartMainFrameNavigation(GURL gurl, |
| 61 int render_process_id, |
| 62 int render_frame_id, |
| 63 void* navigation_handle); |
| 64 |
| 65 // Called when a main frame navigation is completed. |
| 66 void DidFinishMainFrameNavigation(GURL gurl, |
| 67 int render_process_id, |
| 68 int render_frame_id, |
| 69 bool is_same_page_navigation, |
| 70 void* navigation_handle); |
| 71 |
| 72 // Called when a main frame navigation is redirected. |
| 73 void DidRedirectMainFrameNavigation(GURL gurl, |
| 74 int render_process_id, |
| 75 int render_frame_id, |
| 76 void* navigation_handle); |
| 77 |
| 78 private: |
| 79 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriber); |
| 80 }; |
| 81 |
| 82 } // namespace data_use_measurement |
| 83 |
| 84 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ |
OLD | NEW |