| 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 #include "components/web_restrictions/browser/web_restrictions_client.h" | 5 #include "components/web_restrictions/browser/web_restrictions_client.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // Initialize the content resolver. | 88 // Initialize the content resolver. |
| 89 initialized_ = !content_provider_authority.empty(); | 89 initialized_ = !content_provider_authority.empty(); |
| 90 if (!initialized_) | 90 if (!initialized_) |
| 91 return; | 91 return; |
| 92 java_provider_.Reset(Java_WebRestrictionsClient_create( | 92 java_provider_.Reset(Java_WebRestrictionsClient_create( |
| 93 env, | 93 env, |
| 94 base::android::ConvertUTF8ToJavaString(env, content_provider_authority), | 94 base::android::ConvertUTF8ToJavaString(env, content_provider_authority), |
| 95 reinterpret_cast<jlong>(this))); | 95 reinterpret_cast<jlong>(this))); |
| 96 supports_request_ = false; | 96 supports_request_ = false; |
| 97 base::PostTaskWithTraitsAndReplyWithResult( | 97 base::PostTaskWithTraitsAndReplyWithResult( |
| 98 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 98 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 99 base::TaskPriority::BACKGROUND), | |
| 100 base::Bind(&CheckSupportsRequestTask, java_provider_), | 99 base::Bind(&CheckSupportsRequestTask, java_provider_), |
| 101 base::Bind(&WebRestrictionsClient::RequestSupportKnown, | 100 base::Bind(&WebRestrictionsClient::RequestSupportKnown, |
| 102 base::Unretained(this), provider_authority_)); | 101 base::Unretained(this), provider_authority_)); |
| 103 } | 102 } |
| 104 | 103 |
| 105 UrlAccess WebRestrictionsClient::ShouldProceed( | 104 UrlAccess WebRestrictionsClient::ShouldProceed( |
| 106 bool is_main_frame, | 105 bool is_main_frame, |
| 107 const std::string& url, | 106 const std::string& url, |
| 108 const base::Callback<void(bool)>& callback) { | 107 const base::Callback<void(bool)>& callback) { |
| 109 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 108 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 base::AutoLock lock(lock_); | 243 base::AutoLock lock(lock_); |
| 245 cache_data_.erase(url); | 244 cache_data_.erase(url); |
| 246 } | 245 } |
| 247 | 246 |
| 248 void WebRestrictionsClient::Cache::Clear() { | 247 void WebRestrictionsClient::Cache::Clear() { |
| 249 base::AutoLock lock(lock_); | 248 base::AutoLock lock(lock_); |
| 250 cache_data_.clear(); | 249 cache_data_.clear(); |
| 251 } | 250 } |
| 252 | 251 |
| 253 } // namespace web_restrictions | 252 } // namespace web_restrictions |
| OLD | NEW |