Chromium Code Reviews| 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 // Returns true if the |app_package_name| matches the registered package | |
| 95 // names. |label| must not be null. If a match is found, the |label| is set | |
|
Raj
2015/11/18 18:36:51
nits:
change |label| to |output_label| for more cl
tbansal1
2015/11/18 18:50:50
I think it is clear that since it is a pointer and
| |
| 96 // to the matching rule's label. | |
| 97 bool MatchesAppPackageName(const std::string& app_package_name, | |
| 98 std::string* label) const; | |
| 99 | |
| 94 DataUseTabModel* data_use_tab_model() const { | 100 DataUseTabModel* data_use_tab_model() const { |
| 95 return data_use_tab_model_.get(); | 101 return data_use_tab_model_.get(); |
| 96 } | 102 } |
| 97 | 103 |
| 98 private: | 104 private: |
| 99 friend class ExternalDataUseObserverTest; | 105 friend class ExternalDataUseObserverTest; |
| 100 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); | 106 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, SingleRegex); |
| 101 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); | 107 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, TwoRegex); |
| 102 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); | 108 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, MultipleRegex); |
| 103 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); | 109 FRIEND_TEST_ALL_PREFIXES(ExternalDataUseObserverTest, ChangeRegex); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 | 182 |
| 177 // Stores the matching rules. | 183 // Stores the matching rules. |
| 178 class MatchingRule { | 184 class MatchingRule { |
| 179 public: | 185 public: |
| 180 MatchingRule(const std::string& app_package_name, | 186 MatchingRule(const std::string& app_package_name, |
| 181 scoped_ptr<re2::RE2> pattern, | 187 scoped_ptr<re2::RE2> pattern, |
| 182 const std::string& label); | 188 const std::string& label); |
| 183 ~MatchingRule(); | 189 ~MatchingRule(); |
| 184 | 190 |
| 185 const re2::RE2* pattern() const; | 191 const re2::RE2* pattern() const; |
| 192 const std::string& app_package_name() const; | |
|
Raj
2015/11/18 18:36:51
nits:
If its only used in tests, consider making t
tbansal1
2015/11/18 18:50:50
this is used in external_data_use_observer.cc
| |
| 186 const std::string& label() const; | 193 const std::string& label() const; |
| 187 | 194 |
| 188 private: | 195 private: |
| 189 // Package name of the app that should be matched. | 196 // Package name of the app that should be matched. |
| 190 const std::string app_package_name_; | 197 const std::string app_package_name_; |
| 191 | 198 |
| 192 // RE2 pattern to match against URLs. | 199 // RE2 pattern to match against URLs. |
| 193 scoped_ptr<re2::RE2> pattern_; | 200 scoped_ptr<re2::RE2> pattern_; |
| 194 | 201 |
| 195 // Opaque label that uniquely identifies this matching rule. | 202 // Opaque label that uniquely identifies this matching rule. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); | 329 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); |
| 323 }; | 330 }; |
| 324 | 331 |
| 325 bool RegisterExternalDataUseObserver(JNIEnv* env); | 332 bool RegisterExternalDataUseObserver(JNIEnv* env); |
| 326 | 333 |
| 327 } // namespace android | 334 } // namespace android |
| 328 | 335 |
| 329 } // namespace chrome | 336 } // namespace chrome |
| 330 | 337 |
| 331 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ | 338 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ |
| OLD | NEW |