| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_policy_connector.h" | 9 #include "android_webview/browser/aw_browser_policy_connector.h" |
| 10 #include "android_webview/browser/aw_form_database_service.h" | 10 #include "android_webview/browser/aw_form_database_service.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // trigger only in case of real errors. | 66 // trigger only in case of real errors. |
| 67 LOG(WARNING) << "Failed to delete " << path.AsUTF8Unsafe(); | 67 LOG(WARNING) << "Failed to delete " << path.AsUTF8Unsafe(); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 AwBrowserContext* g_browser_context = NULL; | 71 AwBrowserContext* g_browser_context = NULL; |
| 72 | 72 |
| 73 std::unique_ptr<net::ProxyConfigService> CreateProxyConfigService() { | 73 std::unique_ptr<net::ProxyConfigService> CreateProxyConfigService() { |
| 74 std::unique_ptr<net::ProxyConfigService> config_service = | 74 std::unique_ptr<net::ProxyConfigService> config_service = |
| 75 net::ProxyService::CreateSystemProxyConfigService( | 75 net::ProxyService::CreateSystemProxyConfigService( |
| 76 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 76 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
| 77 nullptr /* Ignored on Android */); | 77 nullptr /* Ignored on Android */); |
| 78 | 78 |
| 79 // TODO(csharrison) Architect the wrapper better so we don't need a cast for | 79 // TODO(csharrison) Architect the wrapper better so we don't need a cast for |
| 80 // android ProxyConfigServices. | 80 // android ProxyConfigServices. |
| 81 net::ProxyConfigServiceAndroid* android_config_service = | 81 net::ProxyConfigServiceAndroid* android_config_service = |
| 82 static_cast<net::ProxyConfigServiceAndroid*>(config_service.get()); | 82 static_cast<net::ProxyConfigServiceAndroid*>(config_service.get()); |
| 83 android_config_service->set_exclude_pac_url(true); | 83 android_config_service->set_exclude_pac_url(true); |
| 84 return config_service; | 84 return config_service; |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool OverrideBlacklistForURL(const GURL& url, bool* block, int* reason) { | 87 bool OverrideBlacklistForURL(const GURL& url, bool* block, int* reason) { |
| 88 // We don't have URLs that should never be blacklisted here. | 88 // We don't have URLs that should never be blacklisted here. |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 | 91 |
| 92 policy::URLBlacklistManager* CreateURLBlackListManager( | 92 policy::URLBlacklistManager* CreateURLBlackListManager( |
| 93 PrefService* pref_service) { | 93 PrefService* pref_service) { |
| 94 policy::URLBlacklist::SegmentURLCallback segment_url_callback = | 94 policy::URLBlacklist::SegmentURLCallback segment_url_callback = |
| 95 static_cast<policy::URLBlacklist::SegmentURLCallback>( | 95 static_cast<policy::URLBlacklist::SegmentURLCallback>( |
| 96 url_formatter::SegmentURL); | 96 url_formatter::SegmentURL); |
| 97 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 97 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
| 98 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 98 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
| 99 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); | 99 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); |
| 100 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = | 100 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = |
| 101 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 101 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
| 102 | 102 |
| 103 return new policy::URLBlacklistManager(pref_service, background_task_runner, | 103 return new policy::URLBlacklistManager(pref_service, background_task_runner, |
| 104 io_task_runner, segment_url_callback, | 104 io_task_runner, segment_url_callback, |
| 105 base::Bind(OverrideBlacklistForURL)); | 105 base::Bind(OverrideBlacklistForURL)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace | 108 } // namespace |
| 109 | 109 |
| 110 // Delete the legacy cache dir (in the app data dir) in 10 seconds after init. | 110 // Delete the legacy cache dir (in the app data dir) in 10 seconds after init. |
| 111 int AwBrowserContext::legacy_cache_removal_delay_ms_ = 10000; | 111 int AwBrowserContext::legacy_cache_removal_delay_ms_ = 10000; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 365 |
| 366 void AwBrowserContext::RebuildTable( | 366 void AwBrowserContext::RebuildTable( |
| 367 const scoped_refptr<URLEnumerator>& enumerator) { | 367 const scoped_refptr<URLEnumerator>& enumerator) { |
| 368 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 368 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
| 369 // can change in the lifetime of this WebView and may not yet be set here. | 369 // can change in the lifetime of this WebView and may not yet be set here. |
| 370 // Therefore this initialization path is not used. | 370 // Therefore this initialization path is not used. |
| 371 enumerator->OnComplete(true); | 371 enumerator->OnComplete(true); |
| 372 } | 372 } |
| 373 | 373 |
| 374 } // namespace android_webview | 374 } // namespace android_webview |
| OLD | NEW |