Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: android_webview/browser/aw_browser_context.cc

Issue 333113002: Move data reduction proxy to Chrome-Proxy header for authentication (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flywheel-refactor-net-fake-a-redirect-response-headers-chrome-proxy-auth
Patch Set: errata Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
18 #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"
19 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" 20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
20 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" 21 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h"
21 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 22 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
22 #include "components/user_prefs/user_prefs.h" 23 #include "components/user_prefs/user_prefs.h"
23 #include "components/visitedlink/browser/visitedlink_master.h" 24 #include "components/visitedlink/browser/visitedlink_master.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/storage_partition.h" 26 #include "content/public/browser/storage_partition.h"
26 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
27 #include "net/cookies/cookie_store.h" 28 #include "net/cookies/cookie_store.h"
28 29
29 using base::FilePath; 30 using base::FilePath;
30 using content::BrowserThread; 31 using content::BrowserThread;
32 using data_reduction_proxy::DataReductionProxyAuthRequestHandler;
31 using data_reduction_proxy::DataReductionProxySettings; 33 using data_reduction_proxy::DataReductionProxySettings;
32 34
33 namespace android_webview { 35 namespace android_webview {
34 36
35 namespace { 37 namespace {
36 38
37 // Shows notifications which correspond to PersistentPrefStore's reading errors. 39 // Shows notifications which correspond to PersistentPrefStore's reading errors.
38 void HandleReadError(PersistentPrefStore::PrefReadError error) { 40 void HandleReadError(PersistentPrefStore::PrefReadError error) {
39 } 41 }
40 42
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); 95 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_);
94 } 96 }
95 97
96 void AwBrowserContext::PreMainMessageLoopRun() { 98 void AwBrowserContext::PreMainMessageLoopRun() {
97 cookie_store_ = CreateCookieStore(this); 99 cookie_store_ = CreateCookieStore(this);
98 #if defined(SPDY_PROXY_AUTH_ORIGIN) 100 #if defined(SPDY_PROXY_AUTH_ORIGIN)
99 data_reduction_proxy_settings_.reset( 101 data_reduction_proxy_settings_.reset(
100 new DataReductionProxySettings( 102 new DataReductionProxySettings(
101 new data_reduction_proxy::DataReductionProxyParams( 103 new data_reduction_proxy::DataReductionProxyParams(
102 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()));
103 #endif 108 #endif
104 109
105 url_request_context_getter_ = 110 url_request_context_getter_ =
106 new AwURLRequestContextGetter(GetPath(), cookie_store_.get()); 111 new AwURLRequestContextGetter(GetPath(), cookie_store_.get());
107 112
108 if (data_reduction_proxy_settings_.get()) { 113 if (data_reduction_proxy_settings_.get()) {
109 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> 114 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator>
110 configurator(new data_reduction_proxy::DataReductionProxyConfigTracker( 115 configurator(new data_reduction_proxy::DataReductionProxyConfigTracker(
111 url_request_context_getter_->proxy_config_service(), 116 url_request_context_getter_->proxy_config_service(),
112 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); 117 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 162 }
158 163
159 AwFormDatabaseService* AwBrowserContext::GetFormDatabaseService() { 164 AwFormDatabaseService* AwBrowserContext::GetFormDatabaseService() {
160 return form_database_service_.get(); 165 return form_database_service_.get();
161 } 166 }
162 167
163 DataReductionProxySettings* AwBrowserContext::GetDataReductionProxySettings() { 168 DataReductionProxySettings* AwBrowserContext::GetDataReductionProxySettings() {
164 return data_reduction_proxy_settings_.get(); 169 return data_reduction_proxy_settings_.get();
165 } 170 }
166 171
172 DataReductionProxyAuthRequestHandler*
173 AwBrowserContext::GetDataReductionProxyAuthRequestHandler() {
174 return data_reduction_proxy_auth_request_handler_.get();
175 }
176
167 // Create user pref service for autofill functionality. 177 // Create user pref service for autofill functionality.
168 void AwBrowserContext::CreateUserPrefServiceIfNecessary() { 178 void AwBrowserContext::CreateUserPrefServiceIfNecessary() {
169 if (user_pref_service_) 179 if (user_pref_service_)
170 return; 180 return;
171 181
172 PrefRegistrySimple* pref_registry = new PrefRegistrySimple(); 182 PrefRegistrySimple* pref_registry = new PrefRegistrySimple();
173 // We only use the autocomplete feature of the Autofill, which is 183 // We only use the autocomplete feature of the Autofill, which is
174 // controlled via the manager_delegate. We don't use the rest 184 // controlled via the manager_delegate. We don't use the rest
175 // of autofill, which is why it is hardcoded as disabled here. 185 // of autofill, which is why it is hardcoded as disabled here.
176 pref_registry->RegisterBooleanPref( 186 pref_registry->RegisterBooleanPref(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 276
267 void AwBrowserContext::RebuildTable( 277 void AwBrowserContext::RebuildTable(
268 const scoped_refptr<URLEnumerator>& enumerator) { 278 const scoped_refptr<URLEnumerator>& enumerator) {
269 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client 279 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client
270 // can change in the lifetime of this WebView and may not yet be set here. 280 // can change in the lifetime of this WebView and may not yet be set here.
271 // Therefore this initialization path is not used. 281 // Therefore this initialization path is not used.
272 enumerator->OnComplete(true); 282 enumerator->OnComplete(true);
273 } 283 }
274 284
275 } // namespace android_webview 285 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_browser_context.h ('k') | android_webview/browser/aw_login_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698