Chromium Code Reviews| Index: chrome/browser/android/data_usage/external_data_use_observer.cc |
| diff --git a/chrome/browser/android/data_usage/external_data_use_observer.cc b/chrome/browser/android/data_usage/external_data_use_observer.cc |
| index a9fd19aaab0637f984efdc1cd238dea81fd66770..70a155dc2ef3ea07aca708e902a4572226c76834 100644 |
| --- a/chrome/browser/android/data_usage/external_data_use_observer.cc |
| +++ b/chrome/browser/android/data_usage/external_data_use_observer.cc |
| @@ -135,7 +135,7 @@ void ExternalDataUseObserver::FetchMatchingRulesOnUIThread() const { |
| env, j_external_data_use_observer_.obj()); |
| } |
| -void ExternalDataUseObserver::FetchMatchingRulesCallback( |
| +void ExternalDataUseObserver::FetchMatchingRulesDone( |
| JNIEnv* env, |
| jobject obj, |
| const base::android::JavaParamRef<jobjectArray>& app_package_name, |
| @@ -158,12 +158,12 @@ void ExternalDataUseObserver::FetchMatchingRulesCallback( |
| io_task_runner_->PostTask( |
| FROM_HERE, |
| - base::Bind(&ExternalDataUseObserver::FetchMatchingRulesCallbackOnIOThread, |
| + base::Bind(&ExternalDataUseObserver::FetchMatchingRulesDoneOnIOThread, |
| GetIOWeakPtr(), app_package_name_native, |
| domain_path_regex_native, label_native)); |
| } |
| -void ExternalDataUseObserver::FetchMatchingRulesCallbackOnIOThread( |
| +void ExternalDataUseObserver::FetchMatchingRulesDoneOnIOThread( |
| const std::vector<std::string>& app_package_name, |
| const std::vector<std::string>& domain_path_regex, |
| const std::vector<std::string>& label) { |
| @@ -382,6 +382,42 @@ bool ExternalDataUseObserver::Matches(const GURL& gurl, |
| return false; |
| } |
| +ExternalDataUseObserver::DataUseReportKey::DataUseReportKey( |
| + const std::string& label, |
| + net::NetworkChangeNotifier::ConnectionType connection_type, |
| + const std::string& mcc_mnc) |
| + : label(label), connection_type(connection_type), mcc_mnc(mcc_mnc) {} |
| + |
| +ExternalDataUseObserver::DataUseReportKey::~DataUseReportKey() {} |
| + |
| +bool ExternalDataUseObserver::DataUseReportKey::operator==( |
| + const DataUseReportKey& other) const { |
| + return (label == other.label && connection_type == other.connection_type && |
|
sclittle
2015/11/10 19:21:57
optional nit: parentheses aren't necessary here.
tbansal1
2015/11/11 21:18:38
Done.
|
| + mcc_mnc == other.mcc_mnc); |
| +} |
| + |
| +ExternalDataUseObserver::DataUseReport::DataUseReport( |
| + const base::Time& start_time, |
| + const base::Time& end_time, |
| + int64_t bytes_downloaded, |
| + int64_t bytes_uploaded) |
| + : start_time(start_time), |
| + end_time(end_time), |
| + bytes_downloaded(bytes_downloaded), |
| + bytes_uploaded(bytes_uploaded) {} |
| + |
| +ExternalDataUseObserver::DataUseReport::~DataUseReport() {} |
| + |
| +size_t ExternalDataUseObserver::DataUseReportKeyHash::operator()( |
| + const DataUseReportKey& k) const { |
| + std::hash<std::string> hash_function; |
| + size_t hash = 1; |
| + hash = hash * 23 + hash_function(k.label); |
| + hash = hash * 43 + k.connection_type; |
| + hash = hash * 83 + hash_function(k.mcc_mnc); |
| + return hash; |
| +} |
| + |
| ExternalDataUseObserver::MatchingRule::MatchingRule( |
| const std::string& app_package_name, |
| scoped_ptr<re2::RE2> pattern, |