Chromium Code Reviews| 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_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; |
| 33 using content::BrowserThread; | 34 using content::BrowserThread; |
| 34 using data_reduction_proxy::DataReductionProxyConfigService; | 35 using data_reduction_proxy::DataReductionProxyConfigService; |
| 35 using data_reduction_proxy::DataReductionProxySettings; | 36 using data_reduction_proxy::DataReductionProxySettings; |
| 37 using data_reduction_proxy::DataReductionProxyStatisticsPrefs; | |
| 36 | 38 |
| 37 namespace android_webview { | 39 namespace android_webview { |
| 38 | 40 |
| 39 namespace { | 41 namespace { |
| 40 | 42 |
| 41 // Shows notifications which correspond to PersistentPrefStore's reading errors. | 43 // Shows notifications which correspond to PersistentPrefStore's reading errors. |
| 42 void HandleReadError(PersistentPrefStore::PrefReadError error) { | 44 void HandleReadError(PersistentPrefStore::PrefReadError error) { |
| 43 } | 45 } |
| 44 | 46 |
| 45 AwBrowserContext* g_browser_context = NULL; | 47 AwBrowserContext* g_browser_context = NULL; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); | 99 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); |
| 98 } | 100 } |
| 99 | 101 |
| 100 void AwBrowserContext::PreMainMessageLoopRun() { | 102 void AwBrowserContext::PreMainMessageLoopRun() { |
| 101 cookie_store_ = CreateCookieStore(this); | 103 cookie_store_ = CreateCookieStore(this); |
| 102 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 104 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
| 103 data_reduction_proxy_settings_.reset( | 105 data_reduction_proxy_settings_.reset( |
| 104 new DataReductionProxySettings( | 106 new DataReductionProxySettings( |
| 105 new data_reduction_proxy::DataReductionProxyParams( | 107 new data_reduction_proxy::DataReductionProxyParams( |
| 106 data_reduction_proxy::DataReductionProxyParams::kAllowed))); | 108 data_reduction_proxy::DataReductionProxyParams::kAllowed))); |
| 109 data_reduction_proxy_statistics_prefs_.reset( | |
| 110 new DataReductionProxyStatisticsPrefs( | |
| 111 user_pref_service_.get(), | |
|
sgurun-gerrit only
2014/09/04 00:32:26
unfortunately this will not work, because we creat
megjablon
2014/09/04 18:28:51
Instead we are just not going to instantiate Data
| |
| 112 base::MessageLoopProxy::current(), | |
| 113 base::TimeDelta())); | |
| 107 #endif | 114 #endif |
| 108 scoped_ptr<DataReductionProxyConfigService> | 115 scoped_ptr<DataReductionProxyConfigService> |
| 109 data_reduction_proxy_config_service( | 116 data_reduction_proxy_config_service( |
| 110 new DataReductionProxyConfigService( | 117 new DataReductionProxyConfigService( |
| 111 scoped_ptr<net::ProxyConfigService>( | 118 scoped_ptr<net::ProxyConfigService>( |
| 112 net::ProxyService::CreateSystemProxyConfigService( | 119 net::ProxyService::CreateSystemProxyConfigService( |
| 113 BrowserThread::GetMessageLoopProxyForThread( | 120 BrowserThread::GetMessageLoopProxyForThread( |
| 114 BrowserThread::IO), | 121 BrowserThread::IO), |
| 115 NULL /* Ignored on Android */)).Pass())); | 122 NULL /* Ignored on Android */)).Pass())); |
| 116 if (data_reduction_proxy_settings_.get()) { | 123 if (data_reduction_proxy_settings_.get()) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 base::PrefServiceFactory pref_service_factory; | 209 base::PrefServiceFactory pref_service_factory; |
| 203 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); | 210 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); |
| 204 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); | 211 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); |
| 205 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass(); | 212 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass(); |
| 206 | 213 |
| 207 user_prefs::UserPrefs::Set(this, user_pref_service_.get()); | 214 user_prefs::UserPrefs::Set(this, user_pref_service_.get()); |
| 208 | 215 |
| 209 if (data_reduction_proxy_settings_.get()) { | 216 if (data_reduction_proxy_settings_.get()) { |
| 210 data_reduction_proxy_settings_->InitDataReductionProxySettings( | 217 data_reduction_proxy_settings_->InitDataReductionProxySettings( |
| 211 user_pref_service_.get(), | 218 user_pref_service_.get(), |
| 212 user_pref_service_.get(), | |
| 213 GetRequestContext()); | 219 GetRequestContext()); |
| 214 | 220 |
| 221 data_reduction_proxy_settings_->SetDataReductionProxyStatisticsPrefs( | |
| 222 data_reduction_proxy_statistics_prefs_.get()); | |
| 223 | |
| 215 data_reduction_proxy_settings_->SetDataReductionProxyEnabled( | 224 data_reduction_proxy_settings_->SetDataReductionProxyEnabled( |
| 216 data_reduction_proxy_enabled_); | 225 data_reduction_proxy_enabled_); |
| 217 } | 226 } |
| 218 } | 227 } |
| 219 | 228 |
| 220 base::FilePath AwBrowserContext::GetPath() const { | 229 base::FilePath AwBrowserContext::GetPath() const { |
| 221 return context_storage_path_; | 230 return context_storage_path_; |
| 222 } | 231 } |
| 223 | 232 |
| 224 bool AwBrowserContext::IsOffTheRecord() const { | 233 bool AwBrowserContext::IsOffTheRecord() const { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 | 296 |
| 288 void AwBrowserContext::RebuildTable( | 297 void AwBrowserContext::RebuildTable( |
| 289 const scoped_refptr<URLEnumerator>& enumerator) { | 298 const scoped_refptr<URLEnumerator>& enumerator) { |
| 290 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 299 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
| 291 // can change in the lifetime of this WebView and may not yet be set here. | 300 // can change in the lifetime of this WebView and may not yet be set here. |
| 292 // Therefore this initialization path is not used. | 301 // Therefore this initialization path is not used. |
| 293 enumerator->OnComplete(true); | 302 enumerator->OnComplete(true); |
| 294 } | 303 } |
| 295 | 304 |
| 296 } // namespace android_webview | 305 } // namespace android_webview |
| OLD | NEW |