| 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 // |label| must not be null. If a match is found, the |label| is set to the | 89 // |label| must not be null. If a match is found, the |label| is set to the |
| 90 // matching rule's label. | 90 // matching rule's label. |
| 91 bool Matches(const GURL& gurl, std::string* label) const; | 91 bool Matches(const GURL& gurl, std::string* label) const; |
| 92 | 92 |
| 93 // Returns true if the |app_package_name| matches the registered package | 93 // Returns true if the |app_package_name| matches the registered package |
| 94 // names. |label| must not be null. If a match is found, the |label| is set | 94 // names. |label| must not be null. If a match is found, the |label| is set |
| 95 // to the matching rule's label. | 95 // to the matching rule's label. |
| 96 bool MatchesAppPackageName(const std::string& app_package_name, | 96 bool MatchesAppPackageName(const std::string& app_package_name, |
| 97 std::string* label) const; | 97 std::string* label) const; |
| 98 | 98 |
| 99 DataUseTabModel* data_use_tab_model() const { | 99 DataUseTabModel* GetDataUseTabModel() const; |
| 100 return data_use_tab_model_.get(); | |
| 101 } | |
| 102 | 100 |
| 103 private: | 101 private: |
| 104 friend class DataUseTabModelTest; | 102 friend class DataUseTabModelTest; |
| 105 friend class ExternalDataUseObserverTest; | 103 friend class ExternalDataUseObserverTest; |
| 106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); | |
| 107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); | |
| 108 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); | |
| 109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); | |
| 110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, LabelRemoved); | |
| 111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 104 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
| 112 AtMostOneDataUseSubmitRequest); | 105 AtMostOneDataUseSubmitRequest); |
| 106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); |
| 107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); |
| 108 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); |
| 109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); |
| 110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, LabelRemoved); |
| 113 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); | 111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); |
| 112 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); |
| 113 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
| 114 PeriodicFetchMatchingRules); |
| 114 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); | 115 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); |
| 116 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ReportTabEventsTest); |
| 117 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); |
| 115 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 118 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
| 116 TimestampsMergedCorrectly); | 119 TimestampsMergedCorrectly); |
| 117 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); | 120 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); |
| 118 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); | |
| 119 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | |
| 120 PeriodicFetchMatchingRules); | |
| 121 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); | |
| 122 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); | 121 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); |
| 123 | 122 |
| 124 // DataUseReportKey is a unique identifier for a data use report. | 123 // DataUseReportKey is a unique identifier for a data use report. |
| 125 struct DataUseReportKey { | 124 struct DataUseReportKey { |
| 126 DataUseReportKey(const std::string& label, | 125 DataUseReportKey(const std::string& label, |
| 127 net::NetworkChangeNotifier::ConnectionType connection_type, | 126 net::NetworkChangeNotifier::ConnectionType connection_type, |
| 128 const std::string& mcc_mnc); | 127 const std::string& mcc_mnc); |
| 129 | 128 |
| 130 bool operator==(const DataUseReportKey& other) const; | 129 bool operator==(const DataUseReportKey& other) const; |
| 131 | 130 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); | 328 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); |
| 330 }; | 329 }; |
| 331 | 330 |
| 332 bool RegisterExternalDataUseObserver(JNIEnv* env); | 331 bool RegisterExternalDataUseObserver(JNIEnv* env); |
| 333 | 332 |
| 334 } // namespace android | 333 } // namespace android |
| 335 | 334 |
| 336 } // namespace chrome | 335 } // namespace chrome |
| 337 | 336 |
| 338 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ | 337 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ |
| OLD | NEW |