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/prefs/pref_registry_simple.h" | 15 #include "base/prefs/pref_registry_simple.h" |
15 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
16 #include "base/prefs/pref_service_factory.h" | 17 #include "base/prefs/pref_service_factory.h" |
17 #include "components/autofill/core/common/autofill_pref_names.h" | 18 #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" | 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/user_prefs/user_prefs.h" | 23 #include "components/user_prefs/user_prefs.h" |
24 #include "components/visitedlink/browser/visitedlink_master.h" | 24 #include "components/visitedlink/browser/visitedlink_master.h" |
25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
26 #include "content/public/browser/storage_partition.h" | 26 #include "content/public/browser/storage_partition.h" |
27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
28 #include "net/cookies/cookie_store.h" | 28 #include "net/cookies/cookie_store.h" |
29 #include "net/proxy/proxy_service.h" | |
29 | 30 |
30 using base::FilePath; | 31 using base::FilePath; |
31 using content::BrowserThread; | 32 using content::BrowserThread; |
32 using data_reduction_proxy::DataReductionProxyAuthRequestHandler; | |
33 using data_reduction_proxy::DataReductionProxySettings; | 33 using data_reduction_proxy::DataReductionProxySettings; |
34 | 34 |
35 namespace android_webview { | 35 namespace android_webview { |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 // Shows notifications which correspond to PersistentPrefStore's reading errors. | 39 // Shows notifications which correspond to PersistentPrefStore's reading errors. |
40 void HandleReadError(PersistentPrefStore::PrefReadError error) { | 40 void HandleReadError(PersistentPrefStore::PrefReadError error) { |
41 } | 41 } |
42 | 42 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); | 95 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); |
96 } | 96 } |
97 | 97 |
98 void AwBrowserContext::PreMainMessageLoopRun() { | 98 void AwBrowserContext::PreMainMessageLoopRun() { |
99 cookie_store_ = CreateCookieStore(this); | 99 cookie_store_ = CreateCookieStore(this); |
100 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 100 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
101 data_reduction_proxy_settings_.reset( | 101 data_reduction_proxy_settings_.reset( |
102 new DataReductionProxySettings( | 102 new DataReductionProxySettings( |
103 new data_reduction_proxy::DataReductionProxyParams( | 103 new data_reduction_proxy::DataReductionProxyParams( |
104 data_reduction_proxy::DataReductionProxyParams::kAllowed))); | 104 data_reduction_proxy::DataReductionProxyParams::kAllowed))); |
105 data_reduction_proxy_auth_request_handler_.reset( | |
106 new DataReductionProxyAuthRequestHandler( | |
107 data_reduction_proxy_settings_->params())); | |
108 #endif | 105 #endif |
109 | |
110 url_request_context_getter_ = | |
111 new AwURLRequestContextGetter(GetPath(), cookie_store_.get()); | |
112 | |
113 if (data_reduction_proxy_settings_.get()) { | 106 if (data_reduction_proxy_settings_.get()) { |
107 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigService> | |
sgurun-gerrit only
2014/08/05 01:26:34
nit: import name from data_reduction_proxy namespa
bengr
2014/08/05 02:35:06
Done.
| |
108 data_reduction_proxy_config_service( | |
109 new data_reduction_proxy::DataReductionProxyConfigService( | |
110 scoped_ptr<net::ProxyConfigService>( | |
111 net::ProxyService::CreateSystemProxyConfigService( | |
112 BrowserThread::GetMessageLoopProxyForThread( | |
113 BrowserThread::IO), | |
114 NULL /* Ignored on Android */)).Pass())); | |
sgurun-gerrit only
2014/08/05 01:26:33
8 line statement is not very readable. you can imp
bengr
2014/08/05 02:35:07
That's a static method not a class so it would onl
| |
114 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> | 115 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> |
115 configurator(new data_reduction_proxy::DataReductionProxyConfigTracker( | 116 configurator(new data_reduction_proxy::DataReductionProxyConfigTracker( |
116 url_request_context_getter_->proxy_config_service(), | 117 base::Bind(&data_reduction_proxy::DataReductionProxyConfigService:: |
sgurun-gerrit only
2014/08/05 01:26:33
drop data_reduction_proxy after addressing the com
bengr
2014/08/05 02:35:07
Done.
| |
118 UpdateProxyConfig, | |
119 base::Unretained( | |
120 data_reduction_proxy_config_service.get())), | |
117 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 121 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
118 data_reduction_proxy_settings_->SetProxyConfigurator(configurator.Pass()); | 122 data_reduction_proxy_settings_->SetProxyConfigurator(configurator.Pass()); |
119 } | 123 } |
124 | |
125 url_request_context_getter_ = | |
126 new AwURLRequestContextGetter(GetPath(), | |
127 cookie_store_.get(), | |
128 data_reduction_proxy_config_service.Pass()); | |
129 | |
120 visitedlink_master_.reset( | 130 visitedlink_master_.reset( |
121 new visitedlink::VisitedLinkMaster(this, this, false)); | 131 new visitedlink::VisitedLinkMaster(this, this, false)); |
122 visitedlink_master_->Init(); | 132 visitedlink_master_->Init(); |
123 | 133 |
124 form_database_service_.reset( | 134 form_database_service_.reset( |
125 new AwFormDatabaseService(context_storage_path_)); | 135 new AwFormDatabaseService(context_storage_path_)); |
126 } | 136 } |
127 | 137 |
128 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 138 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
129 DCHECK(visitedlink_master_); | 139 DCHECK(visitedlink_master_); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 } | 172 } |
163 | 173 |
164 AwFormDatabaseService* AwBrowserContext::GetFormDatabaseService() { | 174 AwFormDatabaseService* AwBrowserContext::GetFormDatabaseService() { |
165 return form_database_service_.get(); | 175 return form_database_service_.get(); |
166 } | 176 } |
167 | 177 |
168 DataReductionProxySettings* AwBrowserContext::GetDataReductionProxySettings() { | 178 DataReductionProxySettings* AwBrowserContext::GetDataReductionProxySettings() { |
169 return data_reduction_proxy_settings_.get(); | 179 return data_reduction_proxy_settings_.get(); |
170 } | 180 } |
171 | 181 |
172 DataReductionProxyAuthRequestHandler* | |
173 AwBrowserContext::GetDataReductionProxyAuthRequestHandler() { | |
174 return data_reduction_proxy_auth_request_handler_.get(); | |
175 } | |
176 | |
177 // Create user pref service for autofill functionality. | 182 // Create user pref service for autofill functionality. |
178 void AwBrowserContext::CreateUserPrefServiceIfNecessary() { | 183 void AwBrowserContext::CreateUserPrefServiceIfNecessary() { |
179 if (user_pref_service_) | 184 if (user_pref_service_) |
180 return; | 185 return; |
181 | 186 |
182 PrefRegistrySimple* pref_registry = new PrefRegistrySimple(); | 187 PrefRegistrySimple* pref_registry = new PrefRegistrySimple(); |
183 // We only use the autocomplete feature of the Autofill, which is | 188 // We only use the autocomplete feature of the Autofill, which is |
184 // controlled via the manager_delegate. We don't use the rest | 189 // controlled via the manager_delegate. We don't use the rest |
185 // of autofill, which is why it is hardcoded as disabled here. | 190 // of autofill, which is why it is hardcoded as disabled here. |
186 pref_registry->RegisterBooleanPref( | 191 pref_registry->RegisterBooleanPref( |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 | 281 |
277 void AwBrowserContext::RebuildTable( | 282 void AwBrowserContext::RebuildTable( |
278 const scoped_refptr<URLEnumerator>& enumerator) { | 283 const scoped_refptr<URLEnumerator>& enumerator) { |
279 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 284 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
280 // can change in the lifetime of this WebView and may not yet be set here. | 285 // can change in the lifetime of this WebView and may not yet be set here. |
281 // Therefore this initialization path is not used. | 286 // Therefore this initialization path is not used. |
282 enumerator->OnComplete(true); | 287 enumerator->OnComplete(true); |
283 } | 288 } |
284 | 289 |
285 } // namespace android_webview | 290 } // namespace android_webview |
OLD | NEW |