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_metrics_service_client.h" |
9 #include "android_webview/browser/aw_permission_manager.h" | 10 #include "android_webview/browser/aw_permission_manager.h" |
10 #include "android_webview/browser/aw_pref_store.h" | 11 #include "android_webview/browser/aw_pref_store.h" |
11 #include "android_webview/browser/aw_quota_manager_bridge.h" | 12 #include "android_webview/browser/aw_quota_manager_bridge.h" |
12 #include "android_webview/browser/aw_resource_context.h" | 13 #include "android_webview/browser/aw_resource_context.h" |
13 #include "android_webview/browser/jni_dependency_factory.h" | 14 #include "android_webview/browser/jni_dependency_factory.h" |
14 #include "android_webview/browser/net/aw_url_request_context_getter.h" | 15 #include "android_webview/browser/net/aw_url_request_context_getter.h" |
15 #include "android_webview/browser/net/init_native_callback.h" | 16 #include "android_webview/browser/net/init_native_callback.h" |
16 #include "android_webview/common/aw_content_client.h" | 17 #include "android_webview/common/aw_content_client.h" |
17 #include "base/base_paths_android.h" | 18 #include "base/base_paths_android.h" |
18 #include "base/bind.h" | 19 #include "base/bind.h" |
19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
20 #include "base/prefs/pref_service.h" | 21 #include "base/prefs/pref_service.h" |
21 #include "base/prefs/pref_service_factory.h" | 22 #include "base/prefs/pref_service_factory.h" |
22 #include "components/autofill/core/common/autofill_pref_names.h" | 23 #include "components/autofill/core/common/autofill_pref_names.h" |
23 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" | 24 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" |
24 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 25 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
25 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 26 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
26 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" | 27 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" |
27 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 28 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
28 #include "components/data_reduction_proxy/core/browser/data_store.h" | 29 #include "components/data_reduction_proxy/core/browser/data_store.h" |
29 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 30 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 31 #include "components/metrics/metrics_service.h" |
30 #include "components/policy/core/browser/browser_policy_connector_base.h" | 32 #include "components/policy/core/browser/browser_policy_connector_base.h" |
31 #include "components/policy/core/browser/configuration_policy_pref_store.h" | 33 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
32 #include "components/policy/core/browser/url_blacklist_manager.h" | 34 #include "components/policy/core/browser/url_blacklist_manager.h" |
33 #include "components/pref_registry/pref_registry_syncable.h" | 35 #include "components/pref_registry/pref_registry_syncable.h" |
34 #include "components/url_formatter/url_fixer.h" | 36 #include "components/url_formatter/url_fixer.h" |
35 #include "components/user_prefs/user_prefs.h" | 37 #include "components/user_prefs/user_prefs.h" |
36 #include "components/visitedlink/browser/visitedlink_master.h" | 38 #include "components/visitedlink/browser/visitedlink_master.h" |
37 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/browser/ssl_host_state_delegate.h" | 40 #include "content/public/browser/ssl_host_state_delegate.h" |
39 #include "content/public/browser/storage_partition.h" | 41 #include "content/public/browser/storage_partition.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 EnsureResourceContextInitialized(this); | 246 EnsureResourceContextInitialized(this); |
245 | 247 |
246 // TODO(dgn) lazy init, see http://crbug.com/521542 | 248 // TODO(dgn) lazy init, see http://crbug.com/521542 |
247 data_reduction_proxy_settings_->InitDataReductionProxySettings( | 249 data_reduction_proxy_settings_->InitDataReductionProxySettings( |
248 kDataReductionProxyEnabled, | 250 kDataReductionProxyEnabled, |
249 user_pref_service_.get(), data_reduction_proxy_io_data_.get(), | 251 user_pref_service_.get(), data_reduction_proxy_io_data_.get(), |
250 data_reduction_proxy_service_.Pass()); | 252 data_reduction_proxy_service_.Pass()); |
251 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true); | 253 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true); |
252 | 254 |
253 blacklist_manager_.reset(CreateURLBlackListManager(user_pref_service_.get())); | 255 blacklist_manager_.reset(CreateURLBlackListManager(user_pref_service_.get())); |
| 256 |
| 257 AwMetricsServiceClient::GetInstance()->Initialize(user_pref_service_.get(), |
| 258 GetRequestContext()); |
| 259 } |
| 260 |
| 261 void AwBrowserContext::PostMainMessageLoopRun() { |
| 262 AwMetricsServiceClient::GetInstance()->Finalize(); |
254 } | 263 } |
255 | 264 |
256 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 265 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
257 DCHECK(visitedlink_master_); | 266 DCHECK(visitedlink_master_); |
258 visitedlink_master_->AddURLs(urls); | 267 visitedlink_master_->AddURLs(urls); |
259 } | 268 } |
260 | 269 |
261 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( | 270 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( |
262 content::ProtocolHandlerMap* protocol_handlers, | 271 content::ProtocolHandlerMap* protocol_handlers, |
263 content::URLRequestInterceptorScopedVector request_interceptors) { | 272 content::URLRequestInterceptorScopedVector request_interceptors) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // hardcoded as disabled here. | 333 // hardcoded as disabled here. |
325 pref_registry->RegisterBooleanPref(autofill::prefs::kAutofillEnabled, false); | 334 pref_registry->RegisterBooleanPref(autofill::prefs::kAutofillEnabled, false); |
326 pref_registry->RegisterBooleanPref(kDataReductionProxyEnabled, false); | 335 pref_registry->RegisterBooleanPref(kDataReductionProxyEnabled, false); |
327 data_reduction_proxy::RegisterSimpleProfilePrefs(pref_registry); | 336 data_reduction_proxy::RegisterSimpleProfilePrefs(pref_registry); |
328 policy::URLBlacklistManager::RegisterProfilePrefs(pref_registry); | 337 policy::URLBlacklistManager::RegisterProfilePrefs(pref_registry); |
329 | 338 |
330 pref_registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); | 339 pref_registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); |
331 pref_registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType, | 340 pref_registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType, |
332 std::string()); | 341 std::string()); |
333 | 342 |
| 343 metrics::MetricsService::RegisterPrefs(pref_registry); |
| 344 |
334 base::PrefServiceFactory pref_service_factory; | 345 base::PrefServiceFactory pref_service_factory; |
335 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); | 346 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); |
336 pref_service_factory.set_managed_prefs( | 347 pref_service_factory.set_managed_prefs( |
337 make_scoped_refptr(new policy::ConfigurationPolicyPrefStore( | 348 make_scoped_refptr(new policy::ConfigurationPolicyPrefStore( |
338 browser_policy_connector_->GetPolicyService(), | 349 browser_policy_connector_->GetPolicyService(), |
339 browser_policy_connector_->GetHandlerList(), | 350 browser_policy_connector_->GetHandlerList(), |
340 policy::POLICY_LEVEL_MANDATORY))); | 351 policy::POLICY_LEVEL_MANDATORY))); |
341 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); | 352 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); |
342 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass(); | 353 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass(); |
343 | 354 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 return; | 469 return; |
459 // We don't care about commit_delay for now. It is just a dummy value. | 470 // We don't care about commit_delay for now. It is just a dummy value. |
460 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); | 471 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
461 data_reduction_proxy_service->EnableCompressionStatisticsLogging( | 472 data_reduction_proxy_service->EnableCompressionStatisticsLogging( |
462 user_pref_service_.get(), | 473 user_pref_service_.get(), |
463 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 474 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
464 commit_delay); | 475 commit_delay); |
465 } | 476 } |
466 | 477 |
467 } // namespace android_webview | 478 } // namespace android_webview |
OLD | NEW |