| 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 <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <unordered_map> | 10 #include <unordered_map> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/hash.h" | 14 #include "base/hash.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/supports_user_data.h" | 16 #include "base/supports_user_data.h" |
| 17 #include "components/data_use_measurement/core/data_use_ascriber.h" | 17 #include "components/data_use_measurement/core/data_use_ascriber.h" |
| 18 #include "content/public/browser/global_request_id.h" | 18 #include "content/public/browser/global_request_id.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 class NavigationHandle; | 22 class NavigationHandle; |
| 23 class RenderFrameHost; | 23 class RenderFrameHost; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace data_use_measurement { | 26 namespace data_use_measurement { |
| 27 | 27 |
| 28 class URLRequestClassifier; |
| 29 |
| 28 // Browser implementation of DataUseAscriber. Maintains a list of | 30 // Browser implementation of DataUseAscriber. Maintains a list of |
| 29 // DataUseRecorder instances, one for each source of data, such as a page | 31 // DataUseRecorder instances, one for each source of data, such as a page |
| 30 // load. | 32 // load. |
| 31 // | 33 // |
| 32 // A page includes all resources loaded in response to a main page navigation. | 34 // A page includes all resources loaded in response to a main page navigation. |
| 33 // The scope of a page load ends either when the tab is closed or a new page | 35 // The scope of a page load ends either when the tab is closed or a new page |
| 34 // load is initiated by clicking on a link, entering a new URL, window location | 36 // load is initiated by clicking on a link, entering a new URL, window location |
| 35 // change, etc. | 37 // change, etc. |
| 36 // | 38 // |
| 37 // For URLRequests initiated outside the context of a page load, such as | 39 // For URLRequests initiated outside the context of a page load, such as |
| (...skipping 14 matching lines...) Expand all Loading... |
| 52 | 54 |
| 53 // DataUseAscriber implementation: | 55 // DataUseAscriber implementation: |
| 54 DataUseRecorder* GetDataUseRecorder(net::URLRequest* request) override; | 56 DataUseRecorder* GetDataUseRecorder(net::URLRequest* request) override; |
| 55 | 57 |
| 56 // Called before a request is sent. | 58 // Called before a request is sent. |
| 57 void OnBeforeUrlRequest(net::URLRequest* request) override; | 59 void OnBeforeUrlRequest(net::URLRequest* request) override; |
| 58 | 60 |
| 59 // Called when a URLRequest is being destroyed. | 61 // Called when a URLRequest is being destroyed. |
| 60 void OnUrlRequestDestroyed(net::URLRequest* request) override; | 62 void OnUrlRequestDestroyed(net::URLRequest* request) override; |
| 61 | 63 |
| 64 std::unique_ptr<URLRequestClassifier> CreateURLRequestClassifier() |
| 65 const override; |
| 66 |
| 62 // Called when a render frame host is created. | 67 // Called when a render frame host is created. |
| 63 void RenderFrameCreated(int render_process_id, | 68 void RenderFrameCreated(int render_process_id, |
| 64 int render_frame_id, | 69 int render_frame_id, |
| 65 int parent_render_process_id, | 70 int parent_render_process_id, |
| 66 int parent_render_frame_id); | 71 int parent_render_frame_id); |
| 67 | 72 |
| 68 // Called when a render frame host is deleted. | 73 // Called when a render frame host is deleted. |
| 69 void RenderFrameDeleted(int render_process_id, | 74 void RenderFrameDeleted(int render_process_id, |
| 70 int render_frame_id, | 75 int render_frame_id, |
| 71 int parent_render_process_id, | 76 int parent_render_process_id, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 DataUseRecorderEntry, | 148 DataUseRecorderEntry, |
| 144 GlobalRequestIDHash> | 149 GlobalRequestIDHash> |
| 145 pending_navigation_data_use_map_; | 150 pending_navigation_data_use_map_; |
| 146 | 151 |
| 147 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriber); | 152 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriber); |
| 148 }; | 153 }; |
| 149 | 154 |
| 150 } // namespace data_use_measurement | 155 } // namespace data_use_measurement |
| 151 | 156 |
| 152 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ | 157 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ |
| OLD | NEW |