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"); | |
aberent
2016/01/21 12:00:43
I think this should be read from a policy (app res
knn
2016/01/21 12:17:22
I was thinking maybe we could override it from pol
| |
268 } | 272 } |
269 | 273 |
270 void AwBrowserContext::PostMainMessageLoopRun() { | 274 void AwBrowserContext::PostMainMessageLoopRun() { |
271 AwMetricsServiceClient::GetInstance()->Finalize(); | 275 AwMetricsServiceClient::GetInstance()->Finalize(); |
272 } | 276 } |
273 | 277 |
274 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 278 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
275 DCHECK(visitedlink_master_); | 279 DCHECK(visitedlink_master_); |
276 visitedlink_master_->AddURLs(urls); | 280 visitedlink_master_->AddURLs(urls); |
277 } | 281 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 return nullptr; | 456 return nullptr; |
453 } | 457 } |
454 | 458 |
455 policy::URLBlacklistManager* AwBrowserContext::GetURLBlacklistManager() { | 459 policy::URLBlacklistManager* AwBrowserContext::GetURLBlacklistManager() { |
456 // Should not be called until the end of PreMainMessageLoopRun, where | 460 // Should not be called until the end of PreMainMessageLoopRun, where |
457 // blacklist_manager_ is initialized. | 461 // blacklist_manager_ is initialized. |
458 DCHECK(blacklist_manager_); | 462 DCHECK(blacklist_manager_); |
459 return blacklist_manager_.get(); | 463 return blacklist_manager_.get(); |
460 } | 464 } |
461 | 465 |
466 web_restriction::ContentResolverWebRestrictionProvider* | |
467 AwBrowserContext::GetWebRestrictionProvider() { | |
468 DCHECK(web_restriction_provider_); | |
469 return web_restriction_provider_.get(); | |
470 } | |
471 | |
462 void AwBrowserContext::RebuildTable( | 472 void AwBrowserContext::RebuildTable( |
463 const scoped_refptr<URLEnumerator>& enumerator) { | 473 const scoped_refptr<URLEnumerator>& enumerator) { |
464 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 474 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
465 // can change in the lifetime of this WebView and may not yet be set here. | 475 // can change in the lifetime of this WebView and may not yet be set here. |
466 // Therefore this initialization path is not used. | 476 // Therefore this initialization path is not used. |
467 enumerator->OnComplete(true); | 477 enumerator->OnComplete(true); |
468 } | 478 } |
469 | 479 |
470 void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() { | 480 void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() { |
471 DCHECK(user_pref_service_.get()); | 481 DCHECK(user_pref_service_.get()); |
472 DCHECK(GetDataReductionProxySettings()); | 482 DCHECK(GetDataReductionProxySettings()); |
473 data_reduction_proxy::DataReductionProxyService* | 483 data_reduction_proxy::DataReductionProxyService* |
474 data_reduction_proxy_service = | 484 data_reduction_proxy_service = |
475 GetDataReductionProxySettings()->data_reduction_proxy_service(); | 485 GetDataReductionProxySettings()->data_reduction_proxy_service(); |
476 DCHECK(data_reduction_proxy_service); | 486 DCHECK(data_reduction_proxy_service); |
477 if (data_reduction_proxy_service->compression_stats()) | 487 if (data_reduction_proxy_service->compression_stats()) |
478 return; | 488 return; |
479 // We don't care about commit_delay for now. It is just a dummy value. | 489 // We don't care about commit_delay for now. It is just a dummy value. |
480 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); | 490 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
481 data_reduction_proxy_service->EnableCompressionStatisticsLogging( | 491 data_reduction_proxy_service->EnableCompressionStatisticsLogging( |
482 user_pref_service_.get(), | 492 user_pref_service_.get(), |
483 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 493 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
484 commit_delay); | 494 commit_delay); |
485 } | 495 } |
486 | 496 |
487 } // namespace android_webview | 497 } // namespace android_webview |
OLD | NEW |