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_browser_policy_connector.h" | 7 #include "android_webview/browser/aw_browser_policy_connector.h" |
8 #include "android_webview/browser/aw_form_database_service.h" | 8 #include "android_webview/browser/aw_form_database_service.h" |
9 #include "android_webview/browser/aw_permission_manager.h" | 9 #include "android_webview/browser/aw_permission_manager.h" |
10 #include "android_webview/browser/aw_pref_store.h" | 10 #include "android_webview/browser/aw_pref_store.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void DeleteDirRecursively(const base::FilePath& path) { | 56 void DeleteDirRecursively(const base::FilePath& path) { |
57 if (!base::DeleteFile(path, true)) { | 57 if (!base::DeleteFile(path, true)) { |
58 // Deleting a non-existent file is considered successful, so this will | 58 // Deleting a non-existent file is considered successful, so this will |
59 // trigger only in case of real errors. | 59 // trigger only in case of real errors. |
60 LOG(WARNING) << "Failed to delete " << path.AsUTF8Unsafe(); | 60 LOG(WARNING) << "Failed to delete " << path.AsUTF8Unsafe(); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 AwBrowserContext* g_browser_context = NULL; | 64 AwBrowserContext* g_browser_context = NULL; |
65 | 65 |
66 net::ProxyConfigService* CreateProxyConfigService() { | 66 scoped_ptr<net::ProxyConfigService> CreateProxyConfigService() { |
67 net::ProxyConfigServiceAndroid* config_service = | 67 scoped_ptr<net::ProxyConfigService> config_service = |
68 static_cast<net::ProxyConfigServiceAndroid*>( | 68 net::ProxyService::CreateSystemProxyConfigService( |
69 net::ProxyService::CreateSystemProxyConfigService( | 69 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
70 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 70 nullptr /* Ignored on Android */); |
71 nullptr /* Ignored on Android */ )); | 71 |
72 config_service->set_exclude_pac_url(true); | 72 // TODO(csharrison) Architect the wrapper better so we don't need a cast for |
73 return config_service; | 73 // android ProxyConfigServices. |
| 74 net::ProxyConfigServiceAndroid* android_config_service = |
| 75 static_cast<net::ProxyConfigServiceAndroid*>(config_service.get()); |
| 76 android_config_service->set_exclude_pac_url(true); |
| 77 return config_service.Pass(); |
74 } | 78 } |
75 | 79 |
76 bool OverrideBlacklistForURL(const GURL& url, bool* block, int* reason) { | 80 bool OverrideBlacklistForURL(const GURL& url, bool* block, int* reason) { |
77 // We don't have URLs that should never be blacklisted here. | 81 // We don't have URLs that should never be blacklisted here. |
78 return false; | 82 return false; |
79 } | 83 } |
80 | 84 |
81 policy::URLBlacklistManager* CreateURLBlackListManager( | 85 policy::URLBlacklistManager* CreateURLBlackListManager( |
82 PrefService* pref_service) { | 86 PrefService* pref_service) { |
83 policy::URLBlacklist::SegmentURLCallback segment_url_callback = | 87 policy::URLBlacklist::SegmentURLCallback segment_url_callback = |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // Delay the legacy dir removal to not impact startup performance. | 174 // Delay the legacy dir removal to not impact startup performance. |
171 BrowserThread::PostDelayedTask( | 175 BrowserThread::PostDelayedTask( |
172 BrowserThread::FILE, FROM_HERE, | 176 BrowserThread::FILE, FROM_HERE, |
173 base::Bind(&DeleteDirRecursively, fallback_cache_dir), | 177 base::Bind(&DeleteDirRecursively, fallback_cache_dir), |
174 base::TimeDelta::FromMilliseconds(legacy_cache_removal_delay_ms_)); | 178 base::TimeDelta::FromMilliseconds(legacy_cache_removal_delay_ms_)); |
175 } else { | 179 } else { |
176 cache_path = fallback_cache_dir; | 180 cache_path = fallback_cache_dir; |
177 LOG(WARNING) << "Failed to get cache directory for Android WebView. " | 181 LOG(WARNING) << "Failed to get cache directory for Android WebView. " |
178 << "Using app data directory as a fallback."; | 182 << "Using app data directory as a fallback."; |
179 } | 183 } |
180 url_request_context_getter_ = | 184 url_request_context_getter_ = new AwURLRequestContextGetter( |
181 new AwURLRequestContextGetter( | 185 cache_path, cookie_store_.get(), CreateProxyConfigService()); |
182 cache_path, cookie_store_.get(), | |
183 make_scoped_ptr(CreateProxyConfigService()).Pass()); | |
184 | 186 |
185 data_reduction_proxy_io_data_.reset( | 187 data_reduction_proxy_io_data_.reset( |
186 new data_reduction_proxy::DataReductionProxyIOData( | 188 new data_reduction_proxy::DataReductionProxyIOData( |
187 data_reduction_proxy::Client::WEBVIEW_ANDROID, | 189 data_reduction_proxy::Client::WEBVIEW_ANDROID, |
188 data_reduction_proxy::DataReductionProxyParams::kAllowed, | 190 data_reduction_proxy::DataReductionProxyParams::kAllowed, |
189 url_request_context_getter_->GetNetLog(), | 191 url_request_context_getter_->GetNetLog(), |
190 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 192 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
191 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 193 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
192 false /* enable */, | 194 false /* enable */, |
193 false /* enable_quic */, | 195 false /* enable_quic */, |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 return; | 436 return; |
435 // We don't care about commit_delay for now. It is just a dummy value. | 437 // We don't care about commit_delay for now. It is just a dummy value. |
436 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); | 438 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
437 data_reduction_proxy_service->EnableCompressionStatisticsLogging( | 439 data_reduction_proxy_service->EnableCompressionStatisticsLogging( |
438 user_pref_service_.get(), | 440 user_pref_service_.get(), |
439 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 441 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
440 commit_delay); | 442 commit_delay); |
441 } | 443 } |
442 | 444 |
443 } // namespace android_webview | 445 } // namespace android_webview |
OLD | NEW |