OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ANDROID_DATA_USAGE_DATA_USE_TAB_MODEL_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_TAB_MODEL_H_ |
6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_TAB_MODEL_H_ | 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_TAB_MODEL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <map> |
10 #include <memory> | 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/callback.h" | 15 #include "base/callback.h" |
15 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
16 #include "base/containers/hash_tables.h" | |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
21 #include "base/threading/thread_checker.h" | 21 #include "base/threading/thread_checker.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "chrome/browser/android/data_usage/tab_data_use_entry.h" | 23 #include "chrome/browser/android/data_usage/tab_data_use_entry.h" |
24 #include "components/sessions/core/session_id.h" | 24 #include "components/sessions/core/session_id.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 FRIEND_TEST_ALL_PREFIXES(DataUseTabModelTest, ObserverStartEndEvents); | 232 FRIEND_TEST_ALL_PREFIXES(DataUseTabModelTest, ObserverStartEndEvents); |
233 FRIEND_TEST_ALL_PREFIXES(DataUseTabModelTest, | 233 FRIEND_TEST_ALL_PREFIXES(DataUseTabModelTest, |
234 ProcessBufferedNavigationEventsAfterRuleFetch); | 234 ProcessBufferedNavigationEventsAfterRuleFetch); |
235 FRIEND_TEST_ALL_PREFIXES(DataUseTabModelTest, TabCloseEvent); | 235 FRIEND_TEST_ALL_PREFIXES(DataUseTabModelTest, TabCloseEvent); |
236 FRIEND_TEST_ALL_PREFIXES(DataUseTabModelTest, TabCloseEventEndsTracking); | 236 FRIEND_TEST_ALL_PREFIXES(DataUseTabModelTest, TabCloseEventEndsTracking); |
237 FRIEND_TEST_ALL_PREFIXES(DataUseTabModelTest, | 237 FRIEND_TEST_ALL_PREFIXES(DataUseTabModelTest, |
238 UnexpiredTabEntryRemovaltimeHistogram); | 238 UnexpiredTabEntryRemovaltimeHistogram); |
239 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 239 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
240 MatchingRuleFetchOnControlAppInstall); | 240 MatchingRuleFetchOnControlAppInstall); |
241 | 241 |
242 typedef base::hash_map<SessionID::id_type, TabDataUseEntry> TabEntryMap; | 242 using TabEntryMap = std::map<SessionID::id_type, TabDataUseEntry>; |
243 | 243 |
244 // Gets the current label of a tab, and the new label if a navigation event | 244 // Gets the current label of a tab, and the new label if a navigation event |
245 // occurs in the tab. |tab_id| is the source tab of the generated event, | 245 // occurs in the tab. |tab_id| is the source tab of the generated event, |
246 // |transition| indicates the type of the UI event/transition, |url| is the | 246 // |transition| indicates the type of the UI event/transition, |url| is the |
247 // URL in the source tab, |package| indicates the android package name of | 247 // URL in the source tab, |package| indicates the android package name of |
248 // external application that initiated the event. |navigation_entry| which can | 248 // external application that initiated the event. |navigation_entry| which can |
249 // be null is the navigation entry of the current navigation in back-forward | 249 // be null is the navigation entry of the current navigation in back-forward |
250 // history. |current_label|, |new_label| and |is_package_match| should not be | 250 // history. |current_label|, |new_label| and |is_package_match| should not be |
251 // null, and are set with current and new labels respectively. |current_label| | 251 // null, and are set with current and new labels respectively. |current_label| |
252 // will be set to empty string, if there is no active tracking session. | 252 // will be set to empty string, if there is no active tracking session. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 base::WeakPtrFactory<DataUseTabModel> weak_factory_; | 321 base::WeakPtrFactory<DataUseTabModel> weak_factory_; |
322 | 322 |
323 DISALLOW_COPY_AND_ASSIGN(DataUseTabModel); | 323 DISALLOW_COPY_AND_ASSIGN(DataUseTabModel); |
324 }; | 324 }; |
325 | 325 |
326 } // namespace android | 326 } // namespace android |
327 | 327 |
328 } // namespace chrome | 328 } // namespace chrome |
329 | 329 |
330 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_TAB_MODEL_H_ | 330 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_TAB_MODEL_H_ |
OLD | NEW |