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

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

Issue 1443683002: Notify DataUseTabModel of navigations and tab closures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed sclittle comments Created 5 years, 1 month 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_EXTERNAL_DATA_USE_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_
6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); 105 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules);
106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); 106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly);
107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, 107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest,
108 TimestampsMergedCorrectly); 108 TimestampsMergedCorrectly);
109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); 109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction);
110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); 110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize);
111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, 111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest,
112 PeriodicFetchMatchingRules); 112 PeriodicFetchMatchingRules);
113 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); 113 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports);
114 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); 114 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations);
115 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ReportTabEventsTest);
sclittle 2015/11/17 22:50:12 Why is this necessary? Can we please not make this
tbansal1 2015/11/18 01:32:24 The public function requires Java object and Java
115 116
116 // DataUseReportKey is a unique identifier for a data use report. 117 // DataUseReportKey is a unique identifier for a data use report.
117 struct DataUseReportKey { 118 struct DataUseReportKey {
118 DataUseReportKey(const std::string& label, 119 DataUseReportKey(const std::string& label,
119 net::NetworkChangeNotifier::ConnectionType connection_type, 120 net::NetworkChangeNotifier::ConnectionType connection_type,
120 const std::string& mcc_mnc); 121 const std::string& mcc_mnc);
121 122
122 bool operator==(const DataUseReportKey& other) const; 123 bool operator==(const DataUseReportKey& other) const;
123 124
124 // Label provided by the matching rules. 125 // Label provided by the matching rules.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 const base::TimeDelta fetch_matching_rules_duration_; 308 const base::TimeDelta fetch_matching_rules_duration_;
308 309
309 // Minimum number of bytes that should be buffered before a data use report is 310 // Minimum number of bytes that should be buffered before a data use report is
310 // submitted. 311 // submitted.
311 const int64_t data_use_report_min_bytes_; 312 const int64_t data_use_report_min_bytes_;
312 313
313 base::ThreadChecker thread_checker_; 314 base::ThreadChecker thread_checker_;
314 315
315 // |io_weak_factory_| and |ui_weak_factory_| are used for posting tasks on the 316 // |io_weak_factory_| and |ui_weak_factory_| are used for posting tasks on the
316 // IO and UI thread, respectively. 317 // IO and UI thread, respectively.
317 base::WeakPtrFactory<ExternalDataUseObserver> io_weak_factory_; 318 base::WeakPtrFactory<ExternalDataUseObserver> io_weak_factory_;
sclittle 2015/11/17 23:13:46 For a future CL: WeakPtrs aren't safe to be invali
tbansal1 2015/11/18 01:32:23 Acknowledged. Yes, currently doing that in a separ
318 base::WeakPtrFactory<ExternalDataUseObserver> ui_weak_factory_; 319 base::WeakPtrFactory<ExternalDataUseObserver> ui_weak_factory_;
319 320
320 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); 321 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver);
321 }; 322 };
322 323
323 bool RegisterExternalDataUseObserver(JNIEnv* env); 324 bool RegisterExternalDataUseObserver(JNIEnv* env);
324 325
325 } // namespace android 326 } // namespace android
326 327
327 } // namespace chrome 328 } // namespace chrome
328 329
329 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ 330 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698