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_auth_requ
est_handler.h" | |
19 #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" |
20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 19 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
21 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" | 20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" |
22 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" | 21 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" |
23 #include "components/user_prefs/user_prefs.h" | 22 #include "components/user_prefs/user_prefs.h" |
24 #include "components/visitedlink/browser/visitedlink_master.h" | 23 #include "components/visitedlink/browser/visitedlink_master.h" |
25 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
26 #include "content/public/browser/storage_partition.h" | 25 #include "content/public/browser/storage_partition.h" |
27 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
28 #include "net/cookies/cookie_store.h" | 27 #include "net/cookies/cookie_store.h" |
29 | 28 |
30 using base::FilePath; | 29 using base::FilePath; |
31 using content::BrowserThread; | 30 using content::BrowserThread; |
32 using data_reduction_proxy::DataReductionProxyAuthRequestHandler; | |
33 using data_reduction_proxy::DataReductionProxySettings; | 31 using data_reduction_proxy::DataReductionProxySettings; |
34 | 32 |
35 namespace android_webview { | 33 namespace android_webview { |
36 | 34 |
37 namespace { | 35 namespace { |
38 | 36 |
39 // Shows notifications which correspond to PersistentPrefStore's reading errors. | 37 // Shows notifications which correspond to PersistentPrefStore's reading errors. |
40 void HandleReadError(PersistentPrefStore::PrefReadError error) { | 38 void HandleReadError(PersistentPrefStore::PrefReadError error) { |
41 } | 39 } |
42 | 40 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); | 93 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); |
96 } | 94 } |
97 | 95 |
98 void AwBrowserContext::PreMainMessageLoopRun() { | 96 void AwBrowserContext::PreMainMessageLoopRun() { |
99 cookie_store_ = CreateCookieStore(this); | 97 cookie_store_ = CreateCookieStore(this); |
100 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 98 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
101 data_reduction_proxy_settings_.reset( | 99 data_reduction_proxy_settings_.reset( |
102 new DataReductionProxySettings( | 100 new DataReductionProxySettings( |
103 new data_reduction_proxy::DataReductionProxyParams( | 101 new data_reduction_proxy::DataReductionProxyParams( |
104 data_reduction_proxy::DataReductionProxyParams::kAllowed))); | 102 data_reduction_proxy::DataReductionProxyParams::kAllowed))); |
105 data_reduction_proxy_auth_request_handler_.reset( | |
106 new DataReductionProxyAuthRequestHandler( | |
107 data_reduction_proxy_settings_->params())); | |
108 #endif | 103 #endif |
109 | 104 |
110 url_request_context_getter_ = | 105 url_request_context_getter_ = |
111 new AwURLRequestContextGetter(GetPath(), cookie_store_.get()); | 106 new AwURLRequestContextGetter(GetPath(), cookie_store_.get()); |
112 | 107 |
113 if (data_reduction_proxy_settings_.get()) { | 108 if (data_reduction_proxy_settings_.get()) { |
114 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> | 109 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> |
115 configurator(new data_reduction_proxy::DataReductionProxyConfigTracker( | 110 configurator(new data_reduction_proxy::DataReductionProxyConfigTracker( |
116 url_request_context_getter_->proxy_config_service(), | 111 url_request_context_getter_->GetDataReductionProxyConfigService(), |
117 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 112 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
118 data_reduction_proxy_settings_->SetProxyConfigurator(configurator.Pass()); | 113 data_reduction_proxy_settings_->SetProxyConfigurator(configurator.Pass()); |
119 } | 114 } |
120 visitedlink_master_.reset( | 115 visitedlink_master_.reset( |
121 new visitedlink::VisitedLinkMaster(this, this, false)); | 116 new visitedlink::VisitedLinkMaster(this, this, false)); |
122 visitedlink_master_->Init(); | 117 visitedlink_master_->Init(); |
123 | 118 |
124 form_database_service_.reset( | 119 form_database_service_.reset( |
125 new AwFormDatabaseService(context_storage_path_)); | 120 new AwFormDatabaseService(context_storage_path_)); |
126 } | 121 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 157 } |
163 | 158 |
164 AwFormDatabaseService* AwBrowserContext::GetFormDatabaseService() { | 159 AwFormDatabaseService* AwBrowserContext::GetFormDatabaseService() { |
165 return form_database_service_.get(); | 160 return form_database_service_.get(); |
166 } | 161 } |
167 | 162 |
168 DataReductionProxySettings* AwBrowserContext::GetDataReductionProxySettings() { | 163 DataReductionProxySettings* AwBrowserContext::GetDataReductionProxySettings() { |
169 return data_reduction_proxy_settings_.get(); | 164 return data_reduction_proxy_settings_.get(); |
170 } | 165 } |
171 | 166 |
172 DataReductionProxyAuthRequestHandler* | |
173 AwBrowserContext::GetDataReductionProxyAuthRequestHandler() { | |
174 return data_reduction_proxy_auth_request_handler_.get(); | |
175 } | |
176 | |
177 // Create user pref service for autofill functionality. | 167 // Create user pref service for autofill functionality. |
178 void AwBrowserContext::CreateUserPrefServiceIfNecessary() { | 168 void AwBrowserContext::CreateUserPrefServiceIfNecessary() { |
179 if (user_pref_service_) | 169 if (user_pref_service_) |
180 return; | 170 return; |
181 | 171 |
182 PrefRegistrySimple* pref_registry = new PrefRegistrySimple(); | 172 PrefRegistrySimple* pref_registry = new PrefRegistrySimple(); |
183 // We only use the autocomplete feature of the Autofill, which is | 173 // We only use the autocomplete feature of the Autofill, which is |
184 // controlled via the manager_delegate. We don't use the rest | 174 // controlled via the manager_delegate. We don't use the rest |
185 // of autofill, which is why it is hardcoded as disabled here. | 175 // of autofill, which is why it is hardcoded as disabled here. |
186 pref_registry->RegisterBooleanPref( | 176 pref_registry->RegisterBooleanPref( |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 266 |
277 void AwBrowserContext::RebuildTable( | 267 void AwBrowserContext::RebuildTable( |
278 const scoped_refptr<URLEnumerator>& enumerator) { | 268 const scoped_refptr<URLEnumerator>& enumerator) { |
279 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 269 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
280 // can change in the lifetime of this WebView and may not yet be set here. | 270 // can change in the lifetime of this WebView and may not yet be set here. |
281 // Therefore this initialization path is not used. | 271 // Therefore this initialization path is not used. |
282 enumerator->OnComplete(true); | 272 enumerator->OnComplete(true); |
283 } | 273 } |
284 | 274 |
285 } // namespace android_webview | 275 } // namespace android_webview |
OLD | NEW |