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::ProxyConfigServiceAndroid> 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 */ )); | |
72 config_service->set_exclude_pac_url(true); | 71 config_service->set_exclude_pac_url(true); |
73 return config_service; | 72 return config_service.Pass(); |
74 } | 73 } |
75 | 74 |
76 bool OverrideBlacklistForURL(const GURL& url, bool* block, int* reason) { | 75 bool OverrideBlacklistForURL(const GURL& url, bool* block, int* reason) { |
77 // We don't have URLs that should never be blacklisted here. | 76 // We don't have URLs that should never be blacklisted here. |
78 return false; | 77 return false; |
79 } | 78 } |
80 | 79 |
81 policy::URLBlacklistManager* CreateURLBlackListManager( | 80 policy::URLBlacklistManager* CreateURLBlackListManager( |
82 PrefService* pref_service) { | 81 PrefService* pref_service) { |
83 policy::URLBlacklist::SegmentURLCallback segment_url_callback = | 82 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. | 169 // Delay the legacy dir removal to not impact startup performance. |
171 BrowserThread::PostDelayedTask( | 170 BrowserThread::PostDelayedTask( |
172 BrowserThread::FILE, FROM_HERE, | 171 BrowserThread::FILE, FROM_HERE, |
173 base::Bind(&DeleteDirRecursively, fallback_cache_dir), | 172 base::Bind(&DeleteDirRecursively, fallback_cache_dir), |
174 base::TimeDelta::FromMilliseconds(legacy_cache_removal_delay_ms_)); | 173 base::TimeDelta::FromMilliseconds(legacy_cache_removal_delay_ms_)); |
175 } else { | 174 } else { |
176 cache_path = fallback_cache_dir; | 175 cache_path = fallback_cache_dir; |
177 LOG(WARNING) << "Failed to get cache directory for Android WebView. " | 176 LOG(WARNING) << "Failed to get cache directory for Android WebView. " |
178 << "Using app data directory as a fallback."; | 177 << "Using app data directory as a fallback."; |
179 } | 178 } |
180 url_request_context_getter_ = | 179 url_request_context_getter_ = new AwURLRequestContextGetter( |
181 new AwURLRequestContextGetter( | 180 cache_path, cookie_store_.get(), CreateProxyConfigService()); |
182 cache_path, cookie_store_.get(), | |
183 make_scoped_ptr(CreateProxyConfigService()).Pass()); | |
184 | 181 |
185 data_reduction_proxy_io_data_.reset( | 182 data_reduction_proxy_io_data_.reset( |
186 new data_reduction_proxy::DataReductionProxyIOData( | 183 new data_reduction_proxy::DataReductionProxyIOData( |
187 data_reduction_proxy::Client::WEBVIEW_ANDROID, | 184 data_reduction_proxy::Client::WEBVIEW_ANDROID, |
188 data_reduction_proxy::DataReductionProxyParams::kAllowed, | 185 data_reduction_proxy::DataReductionProxyParams::kAllowed, |
189 url_request_context_getter_->GetNetLog(), | 186 url_request_context_getter_->GetNetLog(), |
190 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 187 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
191 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 188 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
192 false /* enable */, | 189 false /* enable */, |
193 false /* enable_quic */, | 190 false /* enable_quic */, |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 return; | 431 return; |
435 // We don't care about commit_delay for now. It is just a dummy value. | 432 // We don't care about commit_delay for now. It is just a dummy value. |
436 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); | 433 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
437 data_reduction_proxy_service->EnableCompressionStatisticsLogging( | 434 data_reduction_proxy_service->EnableCompressionStatisticsLogging( |
438 user_pref_service_.get(), | 435 user_pref_service_.get(), |
439 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 436 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
440 commit_delay); | 437 commit_delay); |
441 } | 438 } |
442 | 439 |
443 } // namespace android_webview | 440 } // namespace android_webview |
OLD | NEW |