| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ | 5 #ifndef CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ |
| 6 #define CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ | 6 #define CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "components/data_use_measurement/core/data_use_ascriber.h" | 11 #include "components/data_use_measurement/core/data_use_ascriber.h" |
| 10 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 11 | 13 |
| 12 namespace content { | 14 namespace content { |
| 13 class NavigationHandle; | 15 class NavigationHandle; |
| 14 class RenderFrameHost; | 16 class RenderFrameHost; |
| 15 } | 17 } |
| 16 | 18 |
| 17 namespace data_use_measurement { | 19 namespace data_use_measurement { |
| 18 | 20 |
| 21 class URLRequestClassifier; |
| 22 |
| 19 // Browser implementation of DataUseAscriber. Maintains a list of | 23 // Browser implementation of DataUseAscriber. Maintains a list of |
| 20 // DataUseRecorder instances, one for each source of data, such as a page | 24 // DataUseRecorder instances, one for each source of data, such as a page |
| 21 // load. | 25 // load. |
| 22 // | 26 // |
| 23 // A page includes all resources loaded in response to a main page navigation. | 27 // 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 | 28 // 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 | 29 // load is initiated by clicking on a link, entering a new URL, window location |
| 26 // change, etc. | 30 // change, etc. |
| 27 // | 31 // |
| 28 // For URLRequests initiated outside the context of a page load, such as | 32 // For URLRequests initiated outside the context of a page load, such as |
| 29 // Service Workers, Chrome Services, etc, a new instance of DataUseRecorder | 33 // Service Workers, Chrome Services, etc, a new instance of DataUseRecorder |
| 30 // will be created for each URLRequest. | 34 // will be created for each URLRequest. |
| 31 // | 35 // |
| 32 // Each page load will be associated with an instance of DataUseRecorder. | 36 // 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 | 37 // Each URLRequest initiated in the context of a page load will be mapped to |
| 34 // the DataUseRecorder instance for page load. | 38 // the DataUseRecorder instance for page load. |
| 35 // | 39 // |
| 36 // This class lives entirely on the IO thread. It maintains a copy of frame and | 40 // This class lives entirely on the IO thread. It maintains a copy of frame and |
| 37 // navigation information on the IO thread. | 41 // navigation information on the IO thread. |
| 38 class ChromeDataUseAscriber : public DataUseAscriber { | 42 class ChromeDataUseAscriber : public DataUseAscriber { |
| 39 public: | 43 public: |
| 40 ChromeDataUseAscriber(); | 44 ChromeDataUseAscriber(); |
| 41 | 45 |
| 42 ~ChromeDataUseAscriber() override; | 46 ~ChromeDataUseAscriber() override; |
| 43 | 47 |
| 44 // DataUseAscriber: | 48 // DataUseAscriber: |
| 45 DataUseRecorder* GetDataUseRecorder(net::URLRequest* request) override; | 49 DataUseRecorder* GetDataUseRecorder(net::URLRequest* request) override; |
| 46 | 50 |
| 51 std::unique_ptr<URLRequestClassifier> CreateURLRequestClassifier() |
| 52 const override; |
| 53 |
| 47 // Called when a render frame host is created. | 54 // Called when a render frame host is created. |
| 48 void RenderFrameCreated(int render_process_id, | 55 void RenderFrameCreated(int render_process_id, |
| 49 int render_frame_id, | 56 int render_frame_id, |
| 50 int parent_render_process_id, | 57 int parent_render_process_id, |
| 51 int parent_render_frame_id); | 58 int parent_render_frame_id); |
| 52 | 59 |
| 53 // Called when a render frame host is deleted. | 60 // Called when a render frame host is deleted. |
| 54 void RenderFrameDeleted(int render_process_id, | 61 void RenderFrameDeleted(int render_process_id, |
| 55 int render_frame_id, | 62 int render_frame_id, |
| 56 int parent_render_process_id, | 63 int parent_render_process_id, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 75 int render_frame_id, | 82 int render_frame_id, |
| 76 void* navigation_handle); | 83 void* navigation_handle); |
| 77 | 84 |
| 78 private: | 85 private: |
| 79 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriber); | 86 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriber); |
| 80 }; | 87 }; |
| 81 | 88 |
| 82 } // namespace data_use_measurement | 89 } // namespace data_use_measurement |
| 83 | 90 |
| 84 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ | 91 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ |
| OLD | NEW |