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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Called when a main frame navigation is ready to be committed in a | 84 // Called when a main frame navigation is ready to be committed in a |
85 // renderer. | 85 // renderer. |
86 void ReadyToCommitMainFrameNavigation( | 86 void ReadyToCommitMainFrameNavigation( |
87 GURL gurl, | 87 GURL gurl, |
88 content::GlobalRequestID global_request_id, | 88 content::GlobalRequestID global_request_id, |
89 int render_process_id, | 89 int render_process_id, |
90 int render_frame_id, | 90 int render_frame_id, |
91 bool is_same_page_navigation, | 91 bool is_same_page_navigation, |
92 void* navigation_handle); | 92 void* navigation_handle); |
93 | 93 |
| 94 // Called every time the WebContents changes visibility. |
| 95 void WasShownOrHidden(int main_render_process_id, |
| 96 int main_render_frame_id, |
| 97 bool visible); |
| 98 |
| 99 // Called whenever one of the render frames of a WebContents is swapped. |
| 100 void RenderFrameHostChanged(int old_render_process_id, |
| 101 int old_render_frame_id, |
| 102 int new_render_process_id, |
| 103 int new_render_frame_id); |
94 | 104 |
95 private: | 105 private: |
96 friend class ChromeDataUseAscriberTest; | 106 friend class ChromeDataUseAscriberTest; |
97 | 107 |
98 // Entry in the |data_use_recorders_| list which owns all instances of | 108 // Entry in the |data_use_recorders_| list which owns all instances of |
99 // DataUseRecorder. | 109 // DataUseRecorder. |
100 typedef std::list<ChromeDataUseRecorder> DataUseRecorderList; | 110 typedef std::list<ChromeDataUseRecorder> DataUseRecorderList; |
101 typedef DataUseRecorderList::iterator DataUseRecorderEntry; | 111 typedef DataUseRecorderList::iterator DataUseRecorderEntry; |
102 | 112 |
103 struct GlobalRequestIDHash { | 113 struct GlobalRequestIDHash { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 base::hash_map<RenderFrameHostID, RenderFrameHostID> | 159 base::hash_map<RenderFrameHostID, RenderFrameHostID> |
150 subframe_to_mainframe_map_; | 160 subframe_to_mainframe_map_; |
151 | 161 |
152 // Map from pending navigations to the DataUseRecorderEntry in | 162 // Map from pending navigations to the DataUseRecorderEntry in |
153 // |data_use_recorders_| that the navigation ascribes data use to. | 163 // |data_use_recorders_| that the navigation ascribes data use to. |
154 std::unordered_map<content::GlobalRequestID, | 164 std::unordered_map<content::GlobalRequestID, |
155 DataUseRecorderEntry, | 165 DataUseRecorderEntry, |
156 GlobalRequestIDHash> | 166 GlobalRequestIDHash> |
157 pending_navigation_data_use_map_; | 167 pending_navigation_data_use_map_; |
158 | 168 |
| 169 // Contains the mainframe IDs that are currently visible. |
| 170 base::hash_set<RenderFrameHostID> visible_main_render_frames_; |
| 171 |
159 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriber); | 172 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriber); |
160 }; | 173 }; |
161 | 174 |
162 } // namespace data_use_measurement | 175 } // namespace data_use_measurement |
163 | 176 |
164 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ | 177 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_ |
OLD | NEW |