| OLD | NEW |
| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // Returns true if the |gurl| matches the registered regular expressions. | 89 // Returns true if the |gurl| matches the registered regular expressions. |
| 90 // |label| must not be null. If a match is found, the |label| is set to the | 90 // |label| must not be null. If a match is found, the |label| is set to the |
| 91 // matching rule's label. | 91 // matching rule's label. |
| 92 bool Matches(const GURL& gurl, std::string* label) const; | 92 bool Matches(const GURL& gurl, std::string* label) const; |
| 93 | 93 |
| 94 DataUseTabModel* data_use_tab_model() const { | 94 DataUseTabModel* data_use_tab_model() const { |
| 95 return data_use_tab_model_.get(); | 95 return data_use_tab_model_.get(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 private: | 98 private: |
| 99 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); | |
| 100 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); | |
| 101 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); | |
| 102 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); | |
| 103 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 99 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
| 104 AtMostOneDataUseSubmitRequest); | 100 AtMostOneDataUseSubmitRequest); |
| 101 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); |
| 102 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); |
| 103 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); |
| 104 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); |
| 105 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); | 105 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); |
| 106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); |
| 107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
| 108 PeriodicFetchMatchingRules); |
| 106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); | 109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); |
| 110 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ReportTabEventsTest); |
| 111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); |
| 107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 112 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
| 108 TimestampsMergedCorrectly); | 113 TimestampsMergedCorrectly); |
| 109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); | 114 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); |
| 110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); | |
| 111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | |
| 112 PeriodicFetchMatchingRules); | |
| 113 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); | |
| 114 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); | 115 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); |
| 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 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_ |
| OLD | NEW |