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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "android_webview/browser/aw_browser_policy_connector.h" | 9 #include "android_webview/browser/aw_browser_policy_connector.h" |
10 #include "android_webview/browser/aw_form_database_service.h" | 10 #include "android_webview/browser/aw_form_database_service.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 // UMA uses randomly-generated GUIDs (globally unique identifiers) to | 259 // UMA uses randomly-generated GUIDs (globally unique identifiers) to |
260 // anonymously identify logs. Every WebView-using app on every device | 260 // anonymously identify logs. Every WebView-using app on every device |
261 // is given a GUID, stored in this file in the app's data directory. | 261 // is given a GUID, stored in this file in the app's data directory. |
262 const FilePath guid_file_path = | 262 const FilePath guid_file_path = |
263 GetPath().Append(FILE_PATH_LITERAL("metrics_guid")); | 263 GetPath().Append(FILE_PATH_LITERAL("metrics_guid")); |
264 | 264 |
265 AwMetricsServiceClient::GetInstance()->Initialize(user_pref_service_.get(), | 265 AwMetricsServiceClient::GetInstance()->Initialize(user_pref_service_.get(), |
266 GetRequestContext(), | 266 GetRequestContext(), |
267 guid_file_path); | 267 guid_file_path); |
| 268 web_restriction_provider_.reset( |
| 269 new web_restriction::ContentResolverWebRestrictionProvider()); |
| 270 web_restriction_provider_->Initialize( |
| 271 "com.google.android.apps.chrome.SupervisedUserProvider"); |
268 } | 272 } |
269 | 273 |
270 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 274 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
271 DCHECK(visitedlink_master_); | 275 DCHECK(visitedlink_master_); |
272 visitedlink_master_->AddURLs(urls); | 276 visitedlink_master_->AddURLs(urls); |
273 } | 277 } |
274 | 278 |
275 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( | 279 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( |
276 content::ProtocolHandlerMap* protocol_handlers, | 280 content::ProtocolHandlerMap* protocol_handlers, |
277 content::URLRequestInterceptorScopedVector request_interceptors) { | 281 content::URLRequestInterceptorScopedVector request_interceptors) { |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 return nullptr; | 452 return nullptr; |
449 } | 453 } |
450 | 454 |
451 policy::URLBlacklistManager* AwBrowserContext::GetURLBlacklistManager() { | 455 policy::URLBlacklistManager* AwBrowserContext::GetURLBlacklistManager() { |
452 // Should not be called until the end of PreMainMessageLoopRun, where | 456 // Should not be called until the end of PreMainMessageLoopRun, where |
453 // blacklist_manager_ is initialized. | 457 // blacklist_manager_ is initialized. |
454 DCHECK(blacklist_manager_); | 458 DCHECK(blacklist_manager_); |
455 return blacklist_manager_.get(); | 459 return blacklist_manager_.get(); |
456 } | 460 } |
457 | 461 |
| 462 web_restriction::ContentResolverWebRestrictionProvider* |
| 463 AwBrowserContext::GetWebRestrictionProvider() { |
| 464 DCHECK(web_restriction_provider_); |
| 465 return web_restriction_provider_.get(); |
| 466 } |
| 467 |
458 void AwBrowserContext::RebuildTable( | 468 void AwBrowserContext::RebuildTable( |
459 const scoped_refptr<URLEnumerator>& enumerator) { | 469 const scoped_refptr<URLEnumerator>& enumerator) { |
460 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 470 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
461 // can change in the lifetime of this WebView and may not yet be set here. | 471 // can change in the lifetime of this WebView and may not yet be set here. |
462 // Therefore this initialization path is not used. | 472 // Therefore this initialization path is not used. |
463 enumerator->OnComplete(true); | 473 enumerator->OnComplete(true); |
464 } | 474 } |
465 | 475 |
466 void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() { | 476 void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() { |
467 DCHECK(user_pref_service_.get()); | 477 DCHECK(user_pref_service_.get()); |
468 DCHECK(GetDataReductionProxySettings()); | 478 DCHECK(GetDataReductionProxySettings()); |
469 data_reduction_proxy::DataReductionProxyService* | 479 data_reduction_proxy::DataReductionProxyService* |
470 data_reduction_proxy_service = | 480 data_reduction_proxy_service = |
471 GetDataReductionProxySettings()->data_reduction_proxy_service(); | 481 GetDataReductionProxySettings()->data_reduction_proxy_service(); |
472 DCHECK(data_reduction_proxy_service); | 482 DCHECK(data_reduction_proxy_service); |
473 if (data_reduction_proxy_service->compression_stats()) | 483 if (data_reduction_proxy_service->compression_stats()) |
474 return; | 484 return; |
475 // We don't care about commit_delay for now. It is just a dummy value. | 485 // We don't care about commit_delay for now. It is just a dummy value. |
476 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); | 486 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
477 data_reduction_proxy_service->EnableCompressionStatisticsLogging( | 487 data_reduction_proxy_service->EnableCompressionStatisticsLogging( |
478 user_pref_service_.get(), | 488 user_pref_service_.get(), |
479 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 489 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
480 commit_delay); | 490 commit_delay); |
481 } | 491 } |
482 | 492 |
483 } // namespace android_webview | 493 } // namespace android_webview |
OLD | NEW |