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 <string> | 10 #include <string> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // | 48 // |
49 // This class lives entirely on the IO thread. It maintains a copy of frame and | 49 // This class lives entirely on the IO thread. It maintains a copy of frame and |
50 // navigation information on the IO thread. | 50 // navigation information on the IO thread. |
51 class ChromeDataUseAscriber : public DataUseAscriber { | 51 class ChromeDataUseAscriber : public DataUseAscriber { |
52 public: | 52 public: |
53 ChromeDataUseAscriber(); | 53 ChromeDataUseAscriber(); |
54 | 54 |
55 ~ChromeDataUseAscriber() override; | 55 ~ChromeDataUseAscriber() override; |
56 | 56 |
57 // DataUseAscriber implementation: | 57 // DataUseAscriber implementation: |
58 ChromeDataUseRecorder* GetDataUseRecorder(net::URLRequest* request, | 58 ChromeDataUseRecorder* GetOrCreateDataUseRecorder( |
59 bool can_create_new) override; | 59 net::URLRequest* request) override; |
| 60 ChromeDataUseRecorder* GetDataUseRecorder( |
| 61 const net::URLRequest& request) override; |
60 void OnUrlRequestDestroyed(net::URLRequest* request) override; | 62 void OnUrlRequestDestroyed(net::URLRequest* request) override; |
61 std::unique_ptr<URLRequestClassifier> CreateURLRequestClassifier() | 63 std::unique_ptr<URLRequestClassifier> CreateURLRequestClassifier() |
62 const override; | 64 const override; |
63 | 65 |
64 // Called when a render frame host is created. When the render frame is a main | 66 // Called when a render frame host is created. When the render frame is a main |
65 // frame, |main_render_process_id| and |main_render_frame_id| should be -1. | 67 // frame, |main_render_process_id| and |main_render_frame_id| should be -1. |
66 void RenderFrameCreated(int render_process_id, | 68 void RenderFrameCreated(int render_process_id, |
67 int render_frame_id, | 69 int render_frame_id, |
68 int main_render_process_id, | 70 int main_render_process_id, |
69 int main_render_frame_id); | 71 int main_render_frame_id); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 ~DataUseRecorderEntryAsUserData() override; | 126 ~DataUseRecorderEntryAsUserData() override; |
125 | 127 |
126 DataUseRecorderEntry recorder_entry() { return entry_; } | 128 DataUseRecorderEntry recorder_entry() { return entry_; } |
127 | 129 |
128 static const void* kUserDataKey; | 130 static const void* kUserDataKey; |
129 | 131 |
130 private: | 132 private: |
131 DataUseRecorderEntry entry_; | 133 DataUseRecorderEntry entry_; |
132 }; | 134 }; |
133 | 135 |
134 DataUseRecorderEntry GetDataUseRecorderEntry(net::URLRequest* request, | 136 DataUseRecorderEntry GetOrCreateDataUseRecorderEntry( |
135 bool can_create_new); | 137 net::URLRequest* request); |
136 | 138 |
137 void OnDataUseCompleted(DataUseRecorderEntry entry); | 139 void OnDataUseCompleted(DataUseRecorderEntry entry); |
138 | 140 |
139 DataUseRecorderEntry CreateNewDataUseRecorder(net::URLRequest* request); | 141 DataUseRecorderEntry CreateNewDataUseRecorder(net::URLRequest* request); |
140 | 142 |
141 bool IsRecorderInPendingNavigationMap(net::URLRequest* request); | 143 bool IsRecorderInPendingNavigationMap(net::URLRequest* request); |
142 | 144 |
143 bool IsRecorderInRenderFrameMap(net::URLRequest* request); | 145 bool IsRecorderInRenderFrameMap(net::URLRequest* request); |
144 | 146 |
145 // Owner for all instances of DataUseRecorder. An instance is kept in this | 147 // Owner for all instances of DataUseRecorder. An instance is kept in this |
(...skipping 22 matching lines...) Expand all Loading... |
168 | 170 |
169 // Contains the mainframe IDs that are currently visible. | 171 // Contains the mainframe IDs that are currently visible. |
170 base::hash_set<RenderFrameHostID> visible_main_render_frames_; | 172 base::hash_set<RenderFrameHostID> visible_main_render_frames_; |
171 | 173 |
172 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriber); | 174 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriber); |
173 }; | 175 }; |
174 | 176 |
175 } // namespace data_use_measurement | 177 } // namespace data_use_measurement |
176 | 178 |
177 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ | 179 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ |
OLD | NEW |