Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: android_webview/browser/aw_browser_context.cc

Issue 1474483004: WebView Metrics client implementation (Chromium part) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "android_webview/browser/aw_metrics_service_client.h"
11 #include "android_webview/browser/aw_permission_manager.h" 12 #include "android_webview/browser/aw_permission_manager.h"
12 #include "android_webview/browser/aw_pref_store.h" 13 #include "android_webview/browser/aw_pref_store.h"
13 #include "android_webview/browser/aw_quota_manager_bridge.h" 14 #include "android_webview/browser/aw_quota_manager_bridge.h"
14 #include "android_webview/browser/aw_resource_context.h" 15 #include "android_webview/browser/aw_resource_context.h"
15 #include "android_webview/browser/jni_dependency_factory.h" 16 #include "android_webview/browser/jni_dependency_factory.h"
16 #include "android_webview/browser/net/aw_url_request_context_getter.h" 17 #include "android_webview/browser/net/aw_url_request_context_getter.h"
17 #include "android_webview/browser/net/init_native_callback.h" 18 #include "android_webview/browser/net/init_native_callback.h"
18 #include "android_webview/common/aw_content_client.h" 19 #include "android_webview/common/aw_content_client.h"
19 #include "base/base_paths_android.h" 20 #include "base/base_paths_android.h"
20 #include "base/bind.h" 21 #include "base/bind.h"
21 #include "base/path_service.h" 22 #include "base/path_service.h"
22 #include "base/prefs/pref_service.h" 23 #include "base/prefs/pref_service.h"
23 #include "base/prefs/pref_service_factory.h" 24 #include "base/prefs/pref_service_factory.h"
24 #include "components/autofill/core/common/autofill_pref_names.h" 25 #include "components/autofill/core/common/autofill_pref_names.h"
25 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h" 26 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h"
26 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" 27 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h"
27 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" 28 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h"
28 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h" 29 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h"
29 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" 30 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h"
30 #include "components/data_reduction_proxy/core/browser/data_store.h" 31 #include "components/data_reduction_proxy/core/browser/data_store.h"
31 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 32 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
33 #include "components/metrics/metrics_service.h"
32 #include "components/policy/core/browser/browser_policy_connector_base.h" 34 #include "components/policy/core/browser/browser_policy_connector_base.h"
33 #include "components/policy/core/browser/configuration_policy_pref_store.h" 35 #include "components/policy/core/browser/configuration_policy_pref_store.h"
34 #include "components/policy/core/browser/url_blacklist_manager.h" 36 #include "components/policy/core/browser/url_blacklist_manager.h"
35 #include "components/pref_registry/pref_registry_syncable.h" 37 #include "components/pref_registry/pref_registry_syncable.h"
36 #include "components/url_formatter/url_fixer.h" 38 #include "components/url_formatter/url_fixer.h"
37 #include "components/user_prefs/user_prefs.h" 39 #include "components/user_prefs/user_prefs.h"
38 #include "components/visitedlink/browser/visitedlink_master.h" 40 #include "components/visitedlink/browser/visitedlink_master.h"
39 #include "content/public/browser/browser_thread.h" 41 #include "content/public/browser/browser_thread.h"
40 #include "content/public/browser/ssl_host_state_delegate.h" 42 #include "content/public/browser/ssl_host_state_delegate.h"
41 #include "content/public/browser/storage_partition.h" 43 #include "content/public/browser/storage_partition.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 EnsureResourceContextInitialized(this); 248 EnsureResourceContextInitialized(this);
247 249
248 // TODO(dgn) lazy init, see http://crbug.com/521542 250 // TODO(dgn) lazy init, see http://crbug.com/521542
249 data_reduction_proxy_settings_->InitDataReductionProxySettings( 251 data_reduction_proxy_settings_->InitDataReductionProxySettings(
250 kDataReductionProxyEnabled, user_pref_service_.get(), 252 kDataReductionProxyEnabled, user_pref_service_.get(),
251 data_reduction_proxy_io_data_.get(), 253 data_reduction_proxy_io_data_.get(),
252 std::move(data_reduction_proxy_service_)); 254 std::move(data_reduction_proxy_service_));
253 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true); 255 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true);
254 256
255 blacklist_manager_.reset(CreateURLBlackListManager(user_pref_service_.get())); 257 blacklist_manager_.reset(CreateURLBlackListManager(user_pref_service_.get()));
258
259 AwMetricsServiceClient::GetInstance()->Initialize(user_pref_service_.get(),
260 GetRequestContext());
261 }
262
263 void AwBrowserContext::PostMainMessageLoopRun() {
264 AwMetricsServiceClient::GetInstance()->Finalize();
256 } 265 }
257 266
258 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { 267 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) {
259 DCHECK(visitedlink_master_); 268 DCHECK(visitedlink_master_);
260 visitedlink_master_->AddURLs(urls); 269 visitedlink_master_->AddURLs(urls);
261 } 270 }
262 271
263 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( 272 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext(
264 content::ProtocolHandlerMap* protocol_handlers, 273 content::ProtocolHandlerMap* protocol_handlers,
265 content::URLRequestInterceptorScopedVector request_interceptors) { 274 content::URLRequestInterceptorScopedVector request_interceptors) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 // hardcoded as disabled here. 335 // hardcoded as disabled here.
327 pref_registry->RegisterBooleanPref(autofill::prefs::kAutofillEnabled, false); 336 pref_registry->RegisterBooleanPref(autofill::prefs::kAutofillEnabled, false);
328 pref_registry->RegisterBooleanPref(kDataReductionProxyEnabled, false); 337 pref_registry->RegisterBooleanPref(kDataReductionProxyEnabled, false);
329 data_reduction_proxy::RegisterSimpleProfilePrefs(pref_registry); 338 data_reduction_proxy::RegisterSimpleProfilePrefs(pref_registry);
330 policy::URLBlacklistManager::RegisterProfilePrefs(pref_registry); 339 policy::URLBlacklistManager::RegisterProfilePrefs(pref_registry);
331 340
332 pref_registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); 341 pref_registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string());
333 pref_registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType, 342 pref_registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType,
334 std::string()); 343 std::string());
335 344
345 metrics::MetricsService::RegisterPrefs(pref_registry);
346
336 base::PrefServiceFactory pref_service_factory; 347 base::PrefServiceFactory pref_service_factory;
337 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); 348 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore()));
338 pref_service_factory.set_managed_prefs( 349 pref_service_factory.set_managed_prefs(
339 make_scoped_refptr(new policy::ConfigurationPolicyPrefStore( 350 make_scoped_refptr(new policy::ConfigurationPolicyPrefStore(
340 browser_policy_connector_->GetPolicyService(), 351 browser_policy_connector_->GetPolicyService(),
341 browser_policy_connector_->GetHandlerList(), 352 browser_policy_connector_->GetHandlerList(),
342 policy::POLICY_LEVEL_MANDATORY))); 353 policy::POLICY_LEVEL_MANDATORY)));
343 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); 354 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError));
344 user_pref_service_ = pref_service_factory.Create(pref_registry); 355 user_pref_service_ = pref_service_factory.Create(pref_registry);
345 356
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 return; 471 return;
461 // We don't care about commit_delay for now. It is just a dummy value. 472 // We don't care about commit_delay for now. It is just a dummy value.
462 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); 473 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60);
463 data_reduction_proxy_service->EnableCompressionStatisticsLogging( 474 data_reduction_proxy_service->EnableCompressionStatisticsLogging(
464 user_pref_service_.get(), 475 user_pref_service_.get(),
465 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 476 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
466 commit_delay); 477 commit_delay);
467 } 478 }
468 479
469 } // namespace android_webview 480 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_browser_context.h ('k') | android_webview/browser/aw_browser_main_parts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698