Index: chrome/browser/android/data_usage/data_use_tab_model.h |
diff --git a/chrome/browser/android/data_usage/data_use_tab_model.h b/chrome/browser/android/data_usage/data_use_tab_model.h |
index 2d71ffac0dde7f3d96058f6f58d090ee694ed49b..16e14c7840be9cef02039ed805aa9092a372bafd 100644 |
--- a/chrome/browser/android/data_usage/data_use_tab_model.h |
+++ b/chrome/browser/android/data_usage/data_use_tab_model.h |
@@ -193,9 +193,27 @@ class DataUseTabModel { |
UnexpiredTabEntryRemovaltimeHistogram); |
FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
MatchingRuleFetchOnControlAppInstall); |
+ FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
+ ProcessBufferedNavigationEvents); |
typedef base::hash_map<SessionID::id_type, TabDataUseEntry> TabEntryMap; |
+ // Contains the details of a single UI navigation event. |
+ struct DataUseUINavigationEvent { |
tbansal1
2016/03/29 16:20:41
Methods should come before fields.
Raj
2016/03/29 18:03:21
Done.
|
+ SessionID::id_type tab_id; |
tbansal1
2016/03/29 16:20:41
can these fields be all const?
Raj
2016/03/29 18:03:20
Done.
|
+ TransitionType transition_type; |
+ GURL url; |
+ std::string package; |
+ DataUseUINavigationEvent(SessionID::id_type tab_id, |
+ TransitionType transition_type, |
+ GURL url, |
+ std::string package) |
+ : tab_id(tab_id), |
+ transition_type(transition_type), |
+ url(url), |
+ package(package) {} |
+ }; |
+ |
// Gets the current label of a tab, and the new label if a navigation event |
// occurs in the tab. |tab_id| is the source tab of the generated event, |
// |transition| indicates the type of the UI event/transition, |url| is the |
@@ -231,6 +249,8 @@ class DataUseTabModel { |
// size is |kMaxTabEntries|. |
void CompactTabEntries(); |
+ void ProcessBufferedNavigationEvents(); |
tbansal1
2016/03/29 16:20:41
function comments please.
Raj
2016/03/29 18:03:21
Done.
|
+ |
// Collection of observers that receive tracking session start and end |
// notifications. Notifications are posted on UI thread. |
base::ObserverList<TabDataUseObserver> observers_; |
@@ -258,6 +278,15 @@ class DataUseTabModel { |
// True if the external control app is installed. |
bool is_control_app_installed_; |
+ // Buffers the list of UI navigation events that occurred until the first rule |
tbansal1
2016/03/29 16:20:41
s/Buffers the list of/Buffer of/?
Raj
2016/03/29 18:03:21
Done.
|
+ // fetch is complete or the control app not installed callback was received or |
+ // until |kDefaultMaxNavigationEventsBuffered| navigation events were |
+ // buffered, whichever occurs first. Existence of the vector in scoped_ptr |
+ // indicates if the UI navigation events need to be buffered. If the |
+ // scoped_ptr contains a vector all navigation events will be added to it. |
+ // Otherwise all navigation events will be processed immediately. |
+ scoped_ptr<std::vector<DataUseUINavigationEvent>> data_use_ui_navigations_; |
+ |
base::ThreadChecker thread_checker_; |
base::WeakPtrFactory<DataUseTabModel> weak_factory_; |