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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 // called on a different thread. |success| is true if the request was | 84 // called on a different thread. |success| is true if the request was |
85 // successfully submitted to the external data use observer by Java. Must be | 85 // successfully submitted to the external data use observer by Java. Must be |
86 // called on UI thread. | 86 // called on UI thread. |
87 void OnReportDataUseDone(JNIEnv* env, jobject obj, bool success); | 87 void OnReportDataUseDone(JNIEnv* env, jobject obj, bool success); |
88 | 88 |
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 { | |
sclittle
2015/11/16 23:13:43
Why does this need to be exposed here?
tbansal1
2015/11/17 21:12:33
It is called in io_thread.cc
| |
95 return data_use_tab_model_.get(); | |
96 } | |
97 | |
94 private: | 98 private: |
95 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); | 99 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); |
96 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); | 100 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); |
97 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); | 101 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); |
98 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); | 102 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); |
99 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 103 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
100 AtMostOneDataUseSubmitRequest); | 104 AtMostOneDataUseSubmitRequest); |
101 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); | 105 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleMatchingRules); |
102 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); | 106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ReportsMergedCorrectly); |
103 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
104 TimestampsMergedCorrectly); | 108 TimestampsMergedCorrectly); |
105 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); | 109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, HashFunction); |
106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); | 110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferSize); |
107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, | 111 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, |
108 PeriodicFetchMatchingRules); | 112 PeriodicFetchMatchingRules); |
109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); | 113 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, BufferDataUseReports); |
110 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); | 114 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, Variations); |
115 FRIEND_TEST_ALL_PREFIXES(DataUseUITabModelTest, ReportTabEventsTest); | |
111 | 116 |
112 // DataUseReportKey is a unique identifier for a data use report. | 117 // DataUseReportKey is a unique identifier for a data use report. |
113 struct DataUseReportKey { | 118 struct DataUseReportKey { |
114 DataUseReportKey(const std::string& label, | 119 DataUseReportKey(const std::string& label, |
115 net::NetworkChangeNotifier::ConnectionType connection_type, | 120 net::NetworkChangeNotifier::ConnectionType connection_type, |
116 const std::string& mcc_mnc); | 121 const std::string& mcc_mnc); |
117 | 122 |
118 bool operator==(const DataUseReportKey& other) const; | 123 bool operator==(const DataUseReportKey& other) const; |
119 | 124 |
120 // Label provided by the matching rules. | 125 // Label provided by the matching rules. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); | 321 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); |
317 }; | 322 }; |
318 | 323 |
319 bool RegisterExternalDataUseObserver(JNIEnv* env); | 324 bool RegisterExternalDataUseObserver(JNIEnv* env); |
320 | 325 |
321 } // namespace android | 326 } // namespace android |
322 | 327 |
323 } // namespace chrome | 328 } // namespace chrome |
324 | 329 |
325 #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 |