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

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

Issue 676863002: Use no-op statistics collecting object for WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « android_webview/browser/aw_browser_context.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "android_webview/browser/aw_form_database_service.h" 7 #include "android_webview/browser/aw_form_database_service.h"
8 #include "android_webview/browser/aw_pref_store.h" 8 #include "android_webview/browser/aw_pref_store.h"
9 #include "android_webview/browser/aw_quota_manager_bridge.h" 9 #include "android_webview/browser/aw_quota_manager_bridge.h"
10 #include "android_webview/browser/aw_resource_context.h" 10 #include "android_webview/browser/aw_resource_context.h"
11 #include "android_webview/browser/jni_dependency_factory.h" 11 #include "android_webview/browser/jni_dependency_factory.h"
12 #include "android_webview/browser/net/aw_url_request_context_getter.h" 12 #include "android_webview/browser/net/aw_url_request_context_getter.h"
13 #include "android_webview/browser/net/init_native_callback.h" 13 #include "android_webview/browser/net/init_native_callback.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/prefs/pref_registry_simple.h" 15 #include "base/prefs/pref_registry_simple.h"
16 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
17 #include "base/prefs/pref_service_factory.h" 17 #include "base/prefs/pref_service_factory.h"
18 #include "components/autofill/core/common/autofill_pref_names.h" 18 #include "components/autofill/core/common/autofill_pref_names.h"
19 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se rvice.h" 19 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se rvice.h"
20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" 20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
21 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" 21 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h"
22 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 22 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
23 #include "components/data_reduction_proxy/browser/data_reduction_proxy_statistic s_prefs.h"
23 #include "components/user_prefs/user_prefs.h" 24 #include "components/user_prefs/user_prefs.h"
24 #include "components/visitedlink/browser/visitedlink_master.h" 25 #include "components/visitedlink/browser/visitedlink_master.h"
25 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/ssl_host_state_delegate.h" 27 #include "content/public/browser/ssl_host_state_delegate.h"
27 #include "content/public/browser/storage_partition.h" 28 #include "content/public/browser/storage_partition.h"
28 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
29 #include "net/cookies/cookie_store.h" 30 #include "net/cookies/cookie_store.h"
30 #include "net/proxy/proxy_service.h" 31 #include "net/proxy/proxy_service.h"
31 32
32 using base::FilePath; 33 using base::FilePath;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // not created yet. 88 // not created yet.
88 data_reduction_proxy_enabled_ = enabled; 89 data_reduction_proxy_enabled_ = enabled;
89 AwBrowserContext* context = AwBrowserContext::GetDefault(); 90 AwBrowserContext* context = AwBrowserContext::GetDefault();
90 // Can't enable Data reduction proxy if user pref service is not ready. 91 // Can't enable Data reduction proxy if user pref service is not ready.
91 if (context == NULL || context->user_pref_service_.get() == NULL) 92 if (context == NULL || context->user_pref_service_.get() == NULL)
92 return; 93 return;
93 DataReductionProxySettings* proxy_settings = 94 DataReductionProxySettings* proxy_settings =
94 context->GetDataReductionProxySettings(); 95 context->GetDataReductionProxySettings();
95 if (proxy_settings == NULL) 96 if (proxy_settings == NULL)
96 return; 97 return;
98
99 context->CreateDataReductionProxyStatisticsIfNecessary();
100 proxy_settings->SetDataReductionProxyStatisticsPrefs(
101 context->data_reduction_proxy_statistics_.get());
97 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); 102 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_);
98 } 103 }
99 104
100 void AwBrowserContext::PreMainMessageLoopRun() { 105 void AwBrowserContext::PreMainMessageLoopRun() {
101 cookie_store_ = CreateCookieStore(this); 106 cookie_store_ = CreateCookieStore(this);
102 data_reduction_proxy_settings_.reset( 107 data_reduction_proxy_settings_.reset(
103 new DataReductionProxySettings( 108 new DataReductionProxySettings(
104 new data_reduction_proxy::DataReductionProxyParams( 109 new data_reduction_proxy::DataReductionProxyParams(
105 data_reduction_proxy::DataReductionProxyParams::kAllowed))); 110 data_reduction_proxy::DataReductionProxyParams::kAllowed)));
106 scoped_ptr<DataReductionProxyConfigService> 111 scoped_ptr<DataReductionProxyConfigService>
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 292 }
288 293
289 void AwBrowserContext::RebuildTable( 294 void AwBrowserContext::RebuildTable(
290 const scoped_refptr<URLEnumerator>& enumerator) { 295 const scoped_refptr<URLEnumerator>& enumerator) {
291 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client 296 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client
292 // can change in the lifetime of this WebView and may not yet be set here. 297 // can change in the lifetime of this WebView and may not yet be set here.
293 // Therefore this initialization path is not used. 298 // Therefore this initialization path is not used.
294 enumerator->OnComplete(true); 299 enumerator->OnComplete(true);
295 } 300 }
296 301
302 void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() {
303 DCHECK(user_pref_service_.get());
304
305 if (!data_reduction_proxy_statistics_.get()) {
306 // We don't care about commit_delay for now. It is just a dummy value.
307 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60);
308 data_reduction_proxy_statistics_ =
309 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(
310 new data_reduction_proxy::DataReductionProxyStatisticsPrefs(
311 user_pref_service_.get(),
312 base::MessageLoopProxy::current(),
313 commit_delay));
314 }
315 }
316
297 } // namespace android_webview 317 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_browser_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698