Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1185)

Side by Side Diff: chrome/browser/android/data_usage/data_use_ui_tab_model.h

Issue 1539763004: Miscellaneous fixes to DataUse UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_UI_TAB_MODEL_H_ 5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_UI_TAB_MODEL_H_
6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_UI_TAB_MODEL_H_ 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_UI_TAB_MODEL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 SessionID::id_type tab_id) const; 57 SessionID::id_type tab_id) const;
58 58
59 // Reports a tab closure for the tab with |tab_id| to the DataUseTabModel on 59 // Reports a tab closure for the tab with |tab_id| to the DataUseTabModel on
60 // IO thread. The tab could either have been closed or evicted from the memory 60 // IO thread. The tab could either have been closed or evicted from the memory
61 // by Android. 61 // by Android.
62 void ReportTabClosure(SessionID::id_type tab_id); 62 void ReportTabClosure(SessionID::id_type tab_id);
63 63
64 // Reports a custom tab navigation to the DataUseTabModel on the IO thread. 64 // Reports a custom tab navigation to the DataUseTabModel on the IO thread.
65 // Includes the |tab_id|, |url|, and |package_name| for the navigation. 65 // Includes the |tab_id|, |url|, and |package_name| for the navigation.
66 void ReportCustomTabInitialNavigation(SessionID::id_type tab_id, 66 void ReportCustomTabInitialNavigation(SessionID::id_type tab_id,
67 const std::string& url, 67 const std::string& package_name,
68 const std::string& package_name); 68 const std::string& url);
69 69
70 // Returns true if data use tracking has been started for the tab with id 70 // Returns true if data use tracking has been started for the tab with id
71 // |tab_id|. Calling this function resets the state of the tab. 71 // |tab_id|. Calling this function resets the state of the tab.
72 bool HasDataUseTrackingStarted(SessionID::id_type tab_id); 72 bool HasDataUseTrackingStarted(SessionID::id_type tab_id);
73 73
74 // Returns true if data use tracking has ended for the tab with id |tab_id|. 74 // Returns true if data use tracking has ended for the tab with id |tab_id|.
75 // Calling this function resets the state of the tab. 75 // Calling this function resets the state of the tab.
76 bool HasDataUseTrackingEnded(SessionID::id_type tab_id); 76 bool HasDataUseTrackingEnded(SessionID::id_type tab_id);
77 77
78 // Returns true if the tab with id |tab_id| is currently tracked, and
79 // starting the navigation to |url| with transition type |page_transition|
80 // would end tracking of data use.
81 bool WouldDataUseTrackingEnd(const std::string& url,
82 int page_transition,
83 SessionID::id_type tab_id) const;
84
85 // Notifies that user clicked "Continue" when the dialog box with data use
86 // warning was shown. Includes the |tab_id| on which the warning was shown.
87 void UserClickedContinueOnDialogBox(SessionID::id_type tab_id);
88
78 // Sets the weak pointer to DataUseTabModel. 89 // Sets the weak pointer to DataUseTabModel.
79 void SetDataUseTabModel(base::WeakPtr<DataUseTabModel> data_use_tab_model); 90 void SetDataUseTabModel(base::WeakPtr<DataUseTabModel> data_use_tab_model);
80 91
81 base::WeakPtr<DataUseUITabModel> GetWeakPtr(); 92 base::WeakPtr<DataUseUITabModel> GetWeakPtr();
82 93
83 private: 94 private:
84 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ConvertTransitionType); 95 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ConvertTransitionType);
85 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, EntranceExitState); 96 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, EntranceExitState);
86 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ReportTabEventsTest); 97 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ReportTabEventsTest);
87 98
88 // DataUseTrackingEvent indicates the state of a tab. 99 // DataUseTrackingEvent indicates the state of a tab.
89 enum DataUseTrackingEvent { 100 enum DataUseTrackingEvent {
90 // Indicates that data use tracking has started. 101 // Indicates that data use tracking has started.
91 DATA_USE_TRACKING_STARTED, 102 DATA_USE_TRACKING_STARTED,
92 103
93 // Indicates that data use tracking has ended. 104 // Indicates that data use tracking has ended.
94 DATA_USE_TRACKING_ENDED, 105 DATA_USE_TRACKING_ENDED,
106
107 // Indicates that user clicked "Continue" when the dialog box was shown.
108 DATA_USE_CONTINUE_CLICKED,
95 }; 109 };
96 110
97 typedef base::hash_map<SessionID::id_type, DataUseTrackingEvent> TabEvents; 111 typedef base::hash_map<SessionID::id_type, DataUseTrackingEvent> TabEvents;
98 112
99 // DataUseTabModel::TabDataUseObserver implementation: 113 // DataUseTabModel::TabDataUseObserver implementation:
100 void NotifyTrackingStarting(SessionID::id_type tab_id) override; 114 void NotifyTrackingStarting(SessionID::id_type tab_id) override;
101 void NotifyTrackingEnding(SessionID::id_type tab_id) override; 115 void NotifyTrackingEnding(SessionID::id_type tab_id) override;
102 116
103 // Creates |event| for tab with id |tab_id| and value |event|, if there is no 117 // Creates |event| for tab with id |tab_id| and value |event|, if there is no
104 // existing entry for |tab_id|, and returns true. Otherwise, returns false 118 // existing entry for |tab_id|, and returns true. Otherwise, returns false
(...skipping 28 matching lines...) Expand all
133 base::WeakPtrFactory<DataUseUITabModel> weak_factory_; 147 base::WeakPtrFactory<DataUseUITabModel> weak_factory_;
134 148
135 DISALLOW_COPY_AND_ASSIGN(DataUseUITabModel); 149 DISALLOW_COPY_AND_ASSIGN(DataUseUITabModel);
136 }; 150 };
137 151
138 } // namespace android 152 } // namespace android
139 153
140 } // namespace chrome 154 } // namespace chrome
141 155
142 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_UI_TAB_MODEL_H_ 156 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_DATA_USE_UI_TAB_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698