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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // Ensure the storage partition is initialized in time for DataReductionProxy. | 243 // Ensure the storage partition is initialized in time for DataReductionProxy. |
242 EnsureResourceContextInitialized(this); | 244 EnsureResourceContextInitialized(this); |
243 | 245 |
244 // TODO(dgn) lazy init, see http://crbug.com/521542 | 246 // TODO(dgn) lazy init, see http://crbug.com/521542 |
245 data_reduction_proxy_settings_->InitDataReductionProxySettings( | 247 data_reduction_proxy_settings_->InitDataReductionProxySettings( |
246 user_pref_service_.get(), data_reduction_proxy_io_data_.get(), | 248 user_pref_service_.get(), data_reduction_proxy_io_data_.get(), |
247 data_reduction_proxy_service_.Pass()); | 249 data_reduction_proxy_service_.Pass()); |
248 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true); | 250 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true); |
249 | 251 |
250 blacklist_manager_.reset(CreateURLBlackListManager(user_pref_service_.get())); | 252 blacklist_manager_.reset(CreateURLBlackListManager(user_pref_service_.get())); |
| 253 |
| 254 AwMetricsServiceClient::GetInstance()->Initialize(user_pref_service_.get(), |
| 255 GetRequestContext()); |
| 256 } |
| 257 |
| 258 void AwBrowserContext::PostMainMessageLoopRun() { |
| 259 AwMetricsServiceClient::GetInstance()->Finalize(); |
251 } | 260 } |
252 | 261 |
253 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 262 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
254 DCHECK(visitedlink_master_); | 263 DCHECK(visitedlink_master_); |
255 visitedlink_master_->AddURLs(urls); | 264 visitedlink_master_->AddURLs(urls); |
256 } | 265 } |
257 | 266 |
258 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( | 267 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( |
259 content::ProtocolHandlerMap* protocol_handlers, | 268 content::ProtocolHandlerMap* protocol_handlers, |
260 content::URLRequestInterceptorScopedVector request_interceptors) { | 269 content::URLRequestInterceptorScopedVector request_interceptors) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 autofill::prefs::kAutofillPositiveUploadRate, 0.0); | 334 autofill::prefs::kAutofillPositiveUploadRate, 0.0); |
326 pref_registry->RegisterDoublePref( | 335 pref_registry->RegisterDoublePref( |
327 autofill::prefs::kAutofillNegativeUploadRate, 0.0); | 336 autofill::prefs::kAutofillNegativeUploadRate, 0.0); |
328 data_reduction_proxy::RegisterSimpleProfilePrefs(pref_registry); | 337 data_reduction_proxy::RegisterSimpleProfilePrefs(pref_registry); |
329 policy::URLBlacklistManager::RegisterProfilePrefs(pref_registry); | 338 policy::URLBlacklistManager::RegisterProfilePrefs(pref_registry); |
330 | 339 |
331 pref_registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); | 340 pref_registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); |
332 pref_registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType, | 341 pref_registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType, |
333 std::string()); | 342 std::string()); |
334 | 343 |
| 344 metrics::MetricsService::RegisterPrefs(pref_registry); |
| 345 |
335 base::PrefServiceFactory pref_service_factory; | 346 base::PrefServiceFactory pref_service_factory; |
336 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); | 347 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); |
337 pref_service_factory.set_managed_prefs( | 348 pref_service_factory.set_managed_prefs( |
338 make_scoped_refptr(new policy::ConfigurationPolicyPrefStore( | 349 make_scoped_refptr(new policy::ConfigurationPolicyPrefStore( |
339 browser_policy_connector_->GetPolicyService(), | 350 browser_policy_connector_->GetPolicyService(), |
340 browser_policy_connector_->GetHandlerList(), | 351 browser_policy_connector_->GetHandlerList(), |
341 policy::POLICY_LEVEL_MANDATORY))); | 352 policy::POLICY_LEVEL_MANDATORY))); |
342 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); | 353 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); |
343 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass(); | 354 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass(); |
344 | 355 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 return; | 470 return; |
460 // We don't care about commit_delay for now. It is just a dummy value. | 471 // We don't care about commit_delay for now. It is just a dummy value. |
461 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); | 472 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
462 data_reduction_proxy_service->EnableCompressionStatisticsLogging( | 473 data_reduction_proxy_service->EnableCompressionStatisticsLogging( |
463 user_pref_service_.get(), | 474 user_pref_service_.get(), |
464 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 475 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
465 commit_delay); | 476 commit_delay); |
466 } | 477 } |
467 | 478 |
468 } // namespace android_webview | 479 } // namespace android_webview |
OLD | NEW |