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

Unified Diff: chrome/browser/android/data_usage/data_use_tab_model.h

Issue 2158913002: Make DataUseTabModel and DataUseMatcher more independent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, addressed comments, fixed unittests Created 4 years, 5 months 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 side-by-side diff with in-line comments
Download patch
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 cb28b01e3ff6f140c3b56678c9da67649e7214cf..893437721e7a404e386529f9929e1a35e70d5ac4 100644
--- a/chrome/browser/android/data_usage/data_use_tab_model.h
+++ b/chrome/browser/android/data_usage/data_use_tab_model.h
@@ -11,6 +11,7 @@
#include <string>
#include <vector>
+#include "base/callback.h"
#include "base/containers/hash_tables.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
@@ -105,15 +106,12 @@ class DataUseTabModel {
static const char kDefaultTag[];
static const char kCustomTabTag[];
- DataUseTabModel();
-
- // Initializes |this| on UI thread. |external_data_use_observer_bridge| is the
- // pointer to ExternalDataUseObserverBridge object. DataUseTabModel and
- // ExternalDataUseObserverBridge objects are owned by ExternalDataUseObserver
- // and DataUseTabModel is destroyed first followed by
- // ExternalDataUseObserverBridge.
- void InitOnUIThread(
- const ExternalDataUseObserverBridge* external_data_use_observer_bridge);
+ // |fetch_matching_rules_callback| is the callback to be run to initiate
+ // fetching matching rules and |on_matching_rules_fetched_callback|
+ // is the callback to be run after matching rules are fetched.
+ DataUseTabModel(
+ const base::Closure& fetch_matching_rules_callback,
tbansal1 2016/07/19 17:59:32 May be rename to |force_fetch_matching_rules_callb
tbansal1 2016/07/19 17:59:32 include callback_forward.h for base::Closure.
Raj 2016/07/19 21:29:08 Done.
Raj 2016/07/19 21:29:08 Done.
+ const base::Callback<void(bool)>& on_matching_rules_fetched_callback);
virtual ~DataUseTabModel();
@@ -143,7 +141,7 @@ class DataUseTabModel {
// Notifies the DataUseTabModel that tracking label |label| is removed. Any
// active tracking sessions with the label are ended, without notifying any of
// the TabDataUseObserver.
- virtual void OnTrackingLabelRemoved(std::string label);
+ virtual void OnTrackingLabelRemoved(const std::string& label);
// Gets the tracking information for the tab with id |tab_id| at time
// |timestamp|. |output_info| must not be null. If a tab tracking session is
@@ -306,6 +304,9 @@ class DataUseTabModel {
// Stores the matching patterns.
std::unique_ptr<DataUseMatcher> data_use_matcher_;
+ // Callback to be run to initiate fetching the matching rules.
+ const base::Closure fetch_matching_rules_callback_;
+
// True if DataUseTabModel is ready to process UI navigation events.
// DataUseTabModel will be considered ready when the first rule fetch is
// complete or the control app not installed callback was received, whichever

Powered by Google App Engine
This is Rietveld 408576698