| 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/prefs/pref_registry_simple.h" | 14 #include "base/prefs/pref_registry_simple.h" |
| 15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 16 #include "base/prefs/pref_service_factory.h" | 16 #include "base/prefs/pref_service_factory.h" |
| 17 #include "components/autofill/core/common/autofill_pref_names.h" | 17 #include "components/autofill/core/common/autofill_pref_names.h" |
| 18 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se
rvice.h" | 18 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se
rvice.h" |
| 19 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
| 19 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" | 20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" |
| 20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" | 21 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" |
| 21 #include "components/user_prefs/user_prefs.h" | 22 #include "components/user_prefs/user_prefs.h" |
| 22 #include "components/visitedlink/browser/visitedlink_master.h" | 23 #include "components/visitedlink/browser/visitedlink_master.h" |
| 23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/storage_partition.h" | 25 #include "content/public/browser/storage_partition.h" |
| 25 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 26 #include "net/cookies/cookie_store.h" | 27 #include "net/cookies/cookie_store.h" |
| 27 | 28 |
| 28 using base::FilePath; | 29 using base::FilePath; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 return; | 88 return; |
| 88 DataReductionProxySettings* proxy_settings = | 89 DataReductionProxySettings* proxy_settings = |
| 89 context->GetDataReductionProxySettings(); | 90 context->GetDataReductionProxySettings(); |
| 90 if (proxy_settings == NULL) | 91 if (proxy_settings == NULL) |
| 91 return; | 92 return; |
| 92 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); | 93 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void AwBrowserContext::PreMainMessageLoopRun() { | 96 void AwBrowserContext::PreMainMessageLoopRun() { |
| 96 cookie_store_ = CreateCookieStore(this); | 97 cookie_store_ = CreateCookieStore(this); |
| 97 DataReductionProxySettings::SetAllowed(true); | 98 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
| 98 DataReductionProxySettings::SetPromoAllowed(false); | |
| 99 data_reduction_proxy_settings_.reset( | 99 data_reduction_proxy_settings_.reset( |
| 100 new DataReductionProxySettings()); | 100 new DataReductionProxySettings( |
| 101 data_reduction_proxy_settings_->set_fallback_allowed(false); | 101 new data_reduction_proxy::DataReductionProxyParams( |
| 102 data_reduction_proxy::DataReductionProxyParams::kAllowed))); |
| 103 #endif |
| 102 | 104 |
| 103 url_request_context_getter_ = | 105 url_request_context_getter_ = |
| 104 new AwURLRequestContextGetter(GetPath(), cookie_store_.get()); | 106 new AwURLRequestContextGetter(GetPath(), cookie_store_.get()); |
| 105 | 107 |
| 106 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> | 108 if (data_reduction_proxy_settings_.get()) { |
| 107 configurator(new data_reduction_proxy::DataReductionProxyConfigTracker( | 109 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> |
| 108 url_request_context_getter_->proxy_config_service(), | 110 configurator(new data_reduction_proxy::DataReductionProxyConfigTracker( |
| 109 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 111 url_request_context_getter_->proxy_config_service(), |
| 110 data_reduction_proxy_settings_->SetProxyConfigurator(configurator.Pass()); | 112 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
| 111 | 113 data_reduction_proxy_settings_->SetProxyConfigurator(configurator.Pass()); |
| 114 } |
| 112 visitedlink_master_.reset( | 115 visitedlink_master_.reset( |
| 113 new visitedlink::VisitedLinkMaster(this, this, false)); | 116 new visitedlink::VisitedLinkMaster(this, this, false)); |
| 114 visitedlink_master_->Init(); | 117 visitedlink_master_->Init(); |
| 115 | 118 |
| 116 form_database_service_.reset( | 119 form_database_service_.reset( |
| 117 new AwFormDatabaseService(context_storage_path_)); | 120 new AwFormDatabaseService(context_storage_path_)); |
| 118 } | 121 } |
| 119 | 122 |
| 120 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 123 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
| 121 DCHECK(visitedlink_master_); | 124 DCHECK(visitedlink_master_); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 data_reduction_proxy::RegisterSimpleProfilePrefs(pref_registry); | 179 data_reduction_proxy::RegisterSimpleProfilePrefs(pref_registry); |
| 177 data_reduction_proxy::RegisterPrefs(pref_registry); | 180 data_reduction_proxy::RegisterPrefs(pref_registry); |
| 178 | 181 |
| 179 base::PrefServiceFactory pref_service_factory; | 182 base::PrefServiceFactory pref_service_factory; |
| 180 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); | 183 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); |
| 181 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); | 184 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); |
| 182 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass(); | 185 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass(); |
| 183 | 186 |
| 184 user_prefs::UserPrefs::Set(this, user_pref_service_.get()); | 187 user_prefs::UserPrefs::Set(this, user_pref_service_.get()); |
| 185 | 188 |
| 186 data_reduction_proxy_settings_->InitDataReductionProxySettings( | 189 if (data_reduction_proxy_settings_.get()) { |
| 187 user_pref_service_.get(), | 190 data_reduction_proxy_settings_->InitDataReductionProxySettings( |
| 188 user_pref_service_.get(), | 191 user_pref_service_.get(), |
| 189 GetRequestContext()); | 192 user_pref_service_.get(), |
| 193 GetRequestContext()); |
| 190 | 194 |
| 191 data_reduction_proxy_settings_->SetDataReductionProxyEnabled( | 195 data_reduction_proxy_settings_->SetDataReductionProxyEnabled( |
| 192 data_reduction_proxy_enabled_); | 196 data_reduction_proxy_enabled_); |
| 197 } |
| 193 } | 198 } |
| 194 | 199 |
| 195 base::FilePath AwBrowserContext::GetPath() const { | 200 base::FilePath AwBrowserContext::GetPath() const { |
| 196 return context_storage_path_; | 201 return context_storage_path_; |
| 197 } | 202 } |
| 198 | 203 |
| 199 bool AwBrowserContext::IsOffTheRecord() const { | 204 bool AwBrowserContext::IsOffTheRecord() const { |
| 200 // Android WebView does not support off the record profile yet. | 205 // Android WebView does not support off the record profile yet. |
| 201 return false; | 206 return false; |
| 202 } | 207 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 302 |
| 298 void AwBrowserContext::RebuildTable( | 303 void AwBrowserContext::RebuildTable( |
| 299 const scoped_refptr<URLEnumerator>& enumerator) { | 304 const scoped_refptr<URLEnumerator>& enumerator) { |
| 300 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 305 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
| 301 // can change in the lifetime of this WebView and may not yet be set here. | 306 // can change in the lifetime of this WebView and may not yet be set here. |
| 302 // Therefore this initialization path is not used. | 307 // Therefore this initialization path is not used. |
| 303 enumerator->OnComplete(true); | 308 enumerator->OnComplete(true); |
| 304 } | 309 } |
| 305 | 310 |
| 306 } // namespace android_webview | 311 } // namespace android_webview |
| OLD | NEW |