| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "android_webview/browser/aw_browser_context.h" | 5 #include "android_webview/browser/aw_browser_context.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_browser_policy_connector.h" | 7 #include "android_webview/browser/aw_browser_policy_connector.h" |
| 8 #include "android_webview/browser/aw_form_database_service.h" | 8 #include "android_webview/browser/aw_form_database_service.h" |
| 9 #include "android_webview/browser/aw_permission_manager.h" | 9 #include "android_webview/browser/aw_permission_manager.h" |
| 10 #include "android_webview/browser/aw_pref_store.h" | 10 #include "android_webview/browser/aw_pref_store.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 27 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
| 28 #include "components/data_reduction_proxy/core/browser/data_store.h" | 28 #include "components/data_reduction_proxy/core/browser/data_store.h" |
| 29 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 29 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 30 #include "components/policy/core/browser/browser_policy_connector_base.h" | 30 #include "components/policy/core/browser/browser_policy_connector_base.h" |
| 31 #include "components/policy/core/browser/configuration_policy_pref_store.h" | 31 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
| 32 #include "components/policy/core/browser/url_blacklist_manager.h" | 32 #include "components/policy/core/browser/url_blacklist_manager.h" |
| 33 #include "components/pref_registry/pref_registry_syncable.h" | 33 #include "components/pref_registry/pref_registry_syncable.h" |
| 34 #include "components/url_formatter/url_fixer.h" | 34 #include "components/url_formatter/url_fixer.h" |
| 35 #include "components/user_prefs/user_prefs.h" | 35 #include "components/user_prefs/user_prefs.h" |
| 36 #include "components/visitedlink/browser/visitedlink_master.h" | 36 #include "components/visitedlink/browser/visitedlink_master.h" |
| 37 #include "components/web_restriction/content_resolver_web_restriction_provider.h
" |
| 37 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
| 38 #include "content/public/browser/ssl_host_state_delegate.h" | 39 #include "content/public/browser/ssl_host_state_delegate.h" |
| 39 #include "content/public/browser/storage_partition.h" | 40 #include "content/public/browser/storage_partition.h" |
| 40 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
| 41 #include "net/cookies/cookie_store.h" | 42 #include "net/cookies/cookie_store.h" |
| 42 #include "net/proxy/proxy_config_service_android.h" | 43 #include "net/proxy/proxy_config_service_android.h" |
| 43 #include "net/proxy/proxy_service.h" | 44 #include "net/proxy/proxy_service.h" |
| 44 | 45 |
| 45 using base::FilePath; | 46 using base::FilePath; |
| 46 using content::BrowserThread; | 47 using content::BrowserThread; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // Ensure the storage partition is initialized in time for DataReductionProxy. | 228 // Ensure the storage partition is initialized in time for DataReductionProxy. |
| 228 EnsureResourceContextInitialized(this); | 229 EnsureResourceContextInitialized(this); |
| 229 | 230 |
| 230 // TODO(dgn) lazy init, see http://crbug.com/521542 | 231 // TODO(dgn) lazy init, see http://crbug.com/521542 |
| 231 data_reduction_proxy_settings_->InitDataReductionProxySettings( | 232 data_reduction_proxy_settings_->InitDataReductionProxySettings( |
| 232 user_pref_service_.get(), data_reduction_proxy_io_data_.get(), | 233 user_pref_service_.get(), data_reduction_proxy_io_data_.get(), |
| 233 data_reduction_proxy_service_.Pass()); | 234 data_reduction_proxy_service_.Pass()); |
| 234 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true); | 235 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true); |
| 235 | 236 |
| 236 blacklist_manager_.reset(CreateURLBlackListManager(user_pref_service_.get())); | 237 blacklist_manager_.reset(CreateURLBlackListManager(user_pref_service_.get())); |
| 238 |
| 239 web_restriction_provider_.reset( |
| 240 new web_restriction::ContentResolverWebRestrictionProvider()); |
| 237 } | 241 } |
| 238 | 242 |
| 239 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 243 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
| 240 DCHECK(visitedlink_master_); | 244 DCHECK(visitedlink_master_); |
| 241 visitedlink_master_->AddURLs(urls); | 245 visitedlink_master_->AddURLs(urls); |
| 242 } | 246 } |
| 243 | 247 |
| 244 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( | 248 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( |
| 245 content::ProtocolHandlerMap* protocol_handlers, | 249 content::ProtocolHandlerMap* protocol_handlers, |
| 246 content::URLRequestInterceptorScopedVector request_interceptors) { | 250 content::URLRequestInterceptorScopedVector request_interceptors) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 return nullptr; | 419 return nullptr; |
| 416 } | 420 } |
| 417 | 421 |
| 418 policy::URLBlacklistManager* AwBrowserContext::GetURLBlacklistManager() { | 422 policy::URLBlacklistManager* AwBrowserContext::GetURLBlacklistManager() { |
| 419 // Should not be called until the end of PreMainMessageLoopRun, where | 423 // Should not be called until the end of PreMainMessageLoopRun, where |
| 420 // blacklist_manager_ is initialized. | 424 // blacklist_manager_ is initialized. |
| 421 DCHECK(blacklist_manager_); | 425 DCHECK(blacklist_manager_); |
| 422 return blacklist_manager_.get(); | 426 return blacklist_manager_.get(); |
| 423 } | 427 } |
| 424 | 428 |
| 429 web_restriction::WebRestrictionProvider* |
| 430 AwBrowserContext::GetWebRestrictionProvider() { |
| 431 DCHECK(web_restriction_provider_); |
| 432 return web_restriction_provider_.get(); |
| 433 } |
| 434 |
| 425 void AwBrowserContext::RebuildTable( | 435 void AwBrowserContext::RebuildTable( |
| 426 const scoped_refptr<URLEnumerator>& enumerator) { | 436 const scoped_refptr<URLEnumerator>& enumerator) { |
| 427 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 437 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
| 428 // can change in the lifetime of this WebView and may not yet be set here. | 438 // can change in the lifetime of this WebView and may not yet be set here. |
| 429 // Therefore this initialization path is not used. | 439 // Therefore this initialization path is not used. |
| 430 enumerator->OnComplete(true); | 440 enumerator->OnComplete(true); |
| 431 } | 441 } |
| 432 | 442 |
| 433 void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() { | 443 void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() { |
| 434 DCHECK(user_pref_service_.get()); | 444 DCHECK(user_pref_service_.get()); |
| 435 DCHECK(GetDataReductionProxySettings()); | 445 DCHECK(GetDataReductionProxySettings()); |
| 436 data_reduction_proxy::DataReductionProxyService* | 446 data_reduction_proxy::DataReductionProxyService* |
| 437 data_reduction_proxy_service = | 447 data_reduction_proxy_service = |
| 438 GetDataReductionProxySettings()->data_reduction_proxy_service(); | 448 GetDataReductionProxySettings()->data_reduction_proxy_service(); |
| 439 DCHECK(data_reduction_proxy_service); | 449 DCHECK(data_reduction_proxy_service); |
| 440 if (data_reduction_proxy_service->compression_stats()) | 450 if (data_reduction_proxy_service->compression_stats()) |
| 441 return; | 451 return; |
| 442 // We don't care about commit_delay for now. It is just a dummy value. | 452 // We don't care about commit_delay for now. It is just a dummy value. |
| 443 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); | 453 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
| 444 data_reduction_proxy_service->EnableCompressionStatisticsLogging( | 454 data_reduction_proxy_service->EnableCompressionStatisticsLogging( |
| 445 user_pref_service_.get(), | 455 user_pref_service_.get(), |
| 446 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 456 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| 447 commit_delay); | 457 commit_delay); |
| 448 } | 458 } |
| 449 | 459 |
| 450 } // namespace android_webview | 460 } // namespace android_webview |
| OLD | NEW |