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