Index: chrome/browser/android/data_usage/data_use_ui_tab_model.h |
diff --git a/chrome/browser/android/data_usage/data_use_ui_tab_model.h b/chrome/browser/android/data_usage/data_use_ui_tab_model.h |
index b3ad1599e2f5022c951381064119c4ee7420d5dc..6d3dba37e7ea4fbb460c99a7a8e31e9cbdefc25f 100644 |
--- a/chrome/browser/android/data_usage/data_use_ui_tab_model.h |
+++ b/chrome/browser/android/data_usage/data_use_ui_tab_model.h |
@@ -14,6 +14,7 @@ |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
#include "base/threading/thread_checker.h" |
+#include "chrome/browser/android/data_usage/data_use_tab_model.h" |
#include "components/keyed_service/core/keyed_service.h" |
#include "ui/base/page_transition_types.h" |
@@ -60,8 +61,14 @@ class DataUseUITabModel : public KeyedService { |
// Calling this function resets the state of the tab. |
bool HasDataUseTrackingEnded(int32_t tab_id); |
+ void set_data_use_tab_model( |
+ base::WeakPtr<DataUseTabModel> data_use_tab_model) { |
+ data_use_tab_model_ = data_use_tab_model_; |
bengr
2015/11/14 03:54:39
bug? You are setting it to itself?
tbansal1
2015/11/16 17:49:08
Done.
|
+ } |
+ |
private: |
FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, EntranceExitState); |
+ FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ConvertTransitionType); |
// DataUseTrackingEvent indicates the state of a tab. |
enum DataUseTrackingEvent { |
@@ -88,6 +95,18 @@ class DataUseUITabModel : public KeyedService { |
// returns true. Otherwise, returns false without modifying the entry. |
bool RemoveTabEvent(int32_t tab_id, DataUseTrackingEvent event); |
+ // Converts |page_transition| to DataUseTabModel::TransitionType enum. |
+ // Returns true if conversion was successful, and updates |transition_type|. |
+ // Otherwise, returns false, and |transition_type| is not changed. |
+ // |transition_type| must not be null. |
+ bool ConvertTransitionType( |
+ ui::PageTransition page_transition, |
+ DataUseTabModel::TransitionType* transition_type) const; |
+ |
+ // |data_use_tab_model_| is notified of browser navigations and tab closures |
+ // on IO thread. |
+ base::WeakPtr<DataUseTabModel> data_use_tab_model_; |
+ |
// |tab_events_| stores tracking events of multiple tabs. |
TabEvents tab_events_; |