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 // TODO(tbansal): Alphabetize this. |
99 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); | 100 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); |
100 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); | 101 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); |
101 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); | 102 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); |
102 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); | 103 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); |
103 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 104 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
104 AtMostOneDataUseSubmitRequest); | 105 AtMostOneDataUseSubmitRequest); |
105 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); | 106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); |
106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); | 107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); |
107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 108 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
108 TimestampsMergedCorrectly); | 109 TimestampsMergedCorrectly); |
109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); | 110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); |
110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); | 111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); |
111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 112 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
112 PeriodicFetchMatchingRules); | 113 PeriodicFetchMatchingRules); |
113 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); | 114 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); |
114 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); | 115 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); |
| 116 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ReportTabEventsTest); |
115 | 117 |
116 // DataUseReportKey is a unique identifier for a data use report. | 118 // DataUseReportKey is a unique identifier for a data use report. |
117 struct DataUseReportKey { | 119 struct DataUseReportKey { |
118 DataUseReportKey(const std::string& label, | 120 DataUseReportKey(const std::string& label, |
119 net::NetworkChangeNotifier::ConnectionType connection_type, | 121 net::NetworkChangeNotifier::ConnectionType connection_type, |
120 const std::string& mcc_mnc); | 122 const std::string& mcc_mnc); |
121 | 123 |
122 bool operator==(const DataUseReportKey& other) const; | 124 bool operator==(const DataUseReportKey& other) const; |
123 | 125 |
124 // Label provided by the matching rules. | 126 // Label provided by the matching rules. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); | 322 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); |
321 }; | 323 }; |
322 | 324 |
323 bool RegisterExternalDataUseObserver(JNIEnv* env); | 325 bool RegisterExternalDataUseObserver(JNIEnv* env); |
324 | 326 |
325 } // namespace android | 327 } // namespace android |
326 | 328 |
327 } // namespace chrome | 329 } // namespace chrome |
328 | 330 |
329 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ | 331 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ |
OLD | NEW |