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" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" | 21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" |
22 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat istics_prefs.h" | 22 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat istics_prefs.h" |
23 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" | 23 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" |
24 #include "components/user_prefs/user_prefs.h" | 24 #include "components/user_prefs/user_prefs.h" |
25 #include "components/visitedlink/browser/visitedlink_master.h" | 25 #include "components/visitedlink/browser/visitedlink_master.h" |
26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/ssl_host_state_delegate.h" | 27 #include "content/public/browser/ssl_host_state_delegate.h" |
28 #include "content/public/browser/storage_partition.h" | 28 #include "content/public/browser/storage_partition.h" |
29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
30 #include "net/cookies/cookie_store.h" | 30 #include "net/cookies/cookie_store.h" |
31 #include "net/proxy/proxy_config_service_android.h" | |
31 #include "net/proxy/proxy_service.h" | 32 #include "net/proxy/proxy_service.h" |
32 | 33 |
33 using base::FilePath; | 34 using base::FilePath; |
34 using content::BrowserThread; | 35 using content::BrowserThread; |
35 using data_reduction_proxy::DataReductionProxyConfigService; | 36 using data_reduction_proxy::DataReductionProxyConfigService; |
36 using data_reduction_proxy::DataReductionProxySettings; | 37 using data_reduction_proxy::DataReductionProxySettings; |
37 | 38 |
38 namespace android_webview { | 39 namespace android_webview { |
39 | 40 |
40 namespace { | 41 namespace { |
41 | 42 |
42 // Shows notifications which correspond to PersistentPrefStore's reading errors. | 43 // Shows notifications which correspond to PersistentPrefStore's reading errors. |
43 void HandleReadError(PersistentPrefStore::PrefReadError error) { | 44 void HandleReadError(PersistentPrefStore::PrefReadError error) { |
44 } | 45 } |
45 | 46 |
46 AwBrowserContext* g_browser_context = NULL; | 47 AwBrowserContext* g_browser_context = NULL; |
47 | 48 |
49 net::ProxyConfigService* CreateProxyConfigService() { | |
50 net::ProxyConfigServiceAndroid* config_service = | |
51 static_cast<net::ProxyConfigServiceAndroid*>( | |
52 net::ProxyService::CreateSystemProxyConfigService( | |
53 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | |
54 nullptr /* Ignored on Android */ )); | |
55 config_service->set_use_local_proxy(true); | |
56 return config_service; | |
57 } | |
58 | |
48 } // namespace | 59 } // namespace |
49 | 60 |
50 // Data reduction proxy is disabled by default. | 61 // Data reduction proxy is disabled by default. |
51 bool AwBrowserContext::data_reduction_proxy_enabled_ = false; | 62 bool AwBrowserContext::data_reduction_proxy_enabled_ = false; |
52 | 63 |
53 AwBrowserContext::AwBrowserContext( | 64 AwBrowserContext::AwBrowserContext( |
54 const FilePath path, | 65 const FilePath path, |
55 JniDependencyFactory* native_factory) | 66 JniDependencyFactory* native_factory) |
56 : context_storage_path_(path), | 67 : context_storage_path_(path), |
57 native_factory_(native_factory) { | 68 native_factory_(native_factory) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 void AwBrowserContext::PreMainMessageLoopRun() { | 116 void AwBrowserContext::PreMainMessageLoopRun() { |
106 cookie_store_ = CreateCookieStore(this); | 117 cookie_store_ = CreateCookieStore(this); |
107 data_reduction_proxy_settings_.reset( | 118 data_reduction_proxy_settings_.reset( |
108 new DataReductionProxySettings( | 119 new DataReductionProxySettings( |
109 new data_reduction_proxy::DataReductionProxyParams( | 120 new data_reduction_proxy::DataReductionProxyParams( |
110 data_reduction_proxy::DataReductionProxyParams::kAllowed))); | 121 data_reduction_proxy::DataReductionProxyParams::kAllowed))); |
111 scoped_ptr<DataReductionProxyConfigService> | 122 scoped_ptr<DataReductionProxyConfigService> |
112 data_reduction_proxy_config_service( | 123 data_reduction_proxy_config_service( |
113 new DataReductionProxyConfigService( | 124 new DataReductionProxyConfigService( |
114 scoped_ptr<net::ProxyConfigService>( | 125 scoped_ptr<net::ProxyConfigService>( |
115 net::ProxyService::CreateSystemProxyConfigService( | 126 CreateProxyConfigService()).Pass())); |
eroman
2014/11/21 01:55:15
Should this be a part of net::ProxySerive::CreateS
sgurun-gerrit only
2014/11/21 02:13:37
I think this is a special case for webview, but I
| |
116 BrowserThread::GetMessageLoopProxyForThread( | |
117 BrowserThread::IO), | |
118 NULL /* Ignored on Android */)).Pass())); | |
119 if (data_reduction_proxy_settings_.get()) { | 127 if (data_reduction_proxy_settings_.get()) { |
120 data_reduction_proxy_configurator_.reset( | 128 data_reduction_proxy_configurator_.reset( |
121 new data_reduction_proxy::DataReductionProxyConfigTracker( | 129 new data_reduction_proxy::DataReductionProxyConfigTracker( |
122 base::Bind(&DataReductionProxyConfigService::UpdateProxyConfig, | 130 base::Bind(&DataReductionProxyConfigService::UpdateProxyConfig, |
123 base::Unretained( | 131 base::Unretained( |
124 data_reduction_proxy_config_service.get())), | 132 data_reduction_proxy_config_service.get())), |
125 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 133 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
126 data_reduction_proxy_settings_->SetProxyConfigurator( | 134 data_reduction_proxy_settings_->SetProxyConfigurator( |
127 data_reduction_proxy_configurator_.get()); | 135 data_reduction_proxy_configurator_.get()); |
128 } | 136 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 data_reduction_proxy_statistics_ = | 321 data_reduction_proxy_statistics_ = |
314 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>( | 322 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>( |
315 new data_reduction_proxy::DataReductionProxyStatisticsPrefs( | 323 new data_reduction_proxy::DataReductionProxyStatisticsPrefs( |
316 user_pref_service_.get(), | 324 user_pref_service_.get(), |
317 base::MessageLoopProxy::current(), | 325 base::MessageLoopProxy::current(), |
318 commit_delay)); | 326 commit_delay)); |
319 } | 327 } |
320 } | 328 } |
321 | 329 |
322 } // namespace android_webview | 330 } // namespace android_webview |
OLD | NEW |