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); | 104 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ReportTabEventsTest); |
107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); | 105 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); |
108 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); | 106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); |
109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); | 107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); |
| 108 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); |
110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, LabelRemoved); | 109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, LabelRemoved); |
111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); | 110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); |
| 111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); |
| 112 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
| 113 PeriodicFetchMatchingRules); |
112 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); | 114 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); |
| 115 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); |
113 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 116 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
114 TimestampsMergedCorrectly); | 117 TimestampsMergedCorrectly); |
115 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); | 118 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); |
116 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); | |
117 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | |
118 PeriodicFetchMatchingRules); | |
119 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); | |
120 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); | 119 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); |
121 | 120 |
122 // DataUseReportKey is a unique identifier for a data use report. | 121 // DataUseReportKey is a unique identifier for a data use report. |
123 struct DataUseReportKey { | 122 struct DataUseReportKey { |
124 DataUseReportKey(const std::string& label, | 123 DataUseReportKey(const std::string& label, |
125 net::NetworkChangeNotifier::ConnectionType connection_type, | 124 net::NetworkChangeNotifier::ConnectionType connection_type, |
126 const std::string& mcc_mnc); | 125 const std::string& mcc_mnc); |
127 | 126 |
128 bool operator==(const DataUseReportKey& other) const; | 127 bool operator==(const DataUseReportKey& other) const; |
129 | 128 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); | 325 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); |
327 }; | 326 }; |
328 | 327 |
329 bool RegisterExternalDataUseObserver(JNIEnv* env); | 328 bool RegisterExternalDataUseObserver(JNIEnv* env); |
330 | 329 |
331 } // namespace android | 330 } // namespace android |
332 | 331 |
333 } // namespace chrome | 332 } // namespace chrome |
334 | 333 |
335 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ | 334 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ |
OLD | NEW |