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" |
11 #include "android_webview/browser/aw_metrics_service_client.h" | 11 #include "android_webview/browser/aw_metrics_service_client.h" |
12 #include "android_webview/browser/aw_permission_manager.h" | 12 #include "android_webview/browser/aw_permission_manager.h" |
13 #include "android_webview/browser/aw_quota_manager_bridge.h" | 13 #include "android_webview/browser/aw_quota_manager_bridge.h" |
14 #include "android_webview/browser/aw_resource_context.h" | 14 #include "android_webview/browser/aw_resource_context.h" |
15 #include "android_webview/browser/jni_dependency_factory.h" | |
16 #include "android_webview/browser/net/aw_url_request_context_getter.h" | 15 #include "android_webview/browser/net/aw_url_request_context_getter.h" |
17 #include "android_webview/common/aw_content_client.h" | 16 #include "android_webview/common/aw_content_client.h" |
18 #include "base/base_paths_android.h" | 17 #include "base/base_paths_android.h" |
19 #include "base/bind.h" | 18 #include "base/bind.h" |
20 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
21 #include "base/path_service.h" | 20 #include "base/path_service.h" |
22 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
23 #include "base/task_scheduler/post_task.h" | 22 #include "base/task_scheduler/post_task.h" |
24 #include "components/autofill/core/common/autofill_pref_names.h" | 23 #include "components/autofill/core/common/autofill_pref_names.h" |
25 #include "components/metrics/metrics_service.h" | 24 #include "components/metrics/metrics_service.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return new policy::URLBlacklistManager(pref_service, background_task_runner, | 104 return new policy::URLBlacklistManager(pref_service, background_task_runner, |
106 io_task_runner, | 105 io_task_runner, |
107 base::Bind(OverrideBlacklistForURL)); | 106 base::Bind(OverrideBlacklistForURL)); |
108 } | 107 } |
109 | 108 |
110 } // namespace | 109 } // namespace |
111 | 110 |
112 // Delete the legacy cache dir (in the app data dir) in 10 seconds after init. | 111 // Delete the legacy cache dir (in the app data dir) in 10 seconds after init. |
113 int AwBrowserContext::legacy_cache_removal_delay_ms_ = 10000; | 112 int AwBrowserContext::legacy_cache_removal_delay_ms_ = 10000; |
114 | 113 |
115 AwBrowserContext::AwBrowserContext( | 114 AwBrowserContext::AwBrowserContext(const FilePath path) |
116 const FilePath path, | 115 : context_storage_path_(path) { |
117 JniDependencyFactory* native_factory) | |
118 : context_storage_path_(path), | |
119 native_factory_(native_factory) { | |
120 DCHECK(!g_browser_context); | 116 DCHECK(!g_browser_context); |
121 g_browser_context = this; | 117 g_browser_context = this; |
122 BrowserContext::Initialize(this, path); | 118 BrowserContext::Initialize(this, path); |
123 | 119 |
124 // This constructor is entered during the creation of ContentBrowserClient, | 120 // This constructor is entered during the creation of ContentBrowserClient, |
125 // before browser threads are created. Therefore any checks to enforce | 121 // before browser threads are created. Therefore any checks to enforce |
126 // threading (such as BrowserThread::CurrentlyOn()) will fail here. | 122 // threading (such as BrowserThread::CurrentlyOn()) will fail here. |
127 } | 123 } |
128 | 124 |
129 AwBrowserContext::~AwBrowserContext() { | 125 AwBrowserContext::~AwBrowserContext() { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 user_pref_service_->GetString(prefs::kWebRestrictionsAuthority)); | 216 user_pref_service_->GetString(prefs::kWebRestrictionsAuthority)); |
221 } | 217 } |
222 | 218 |
223 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 219 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
224 DCHECK(visitedlink_master_); | 220 DCHECK(visitedlink_master_); |
225 visitedlink_master_->AddURLs(urls); | 221 visitedlink_master_->AddURLs(urls); |
226 } | 222 } |
227 | 223 |
228 AwQuotaManagerBridge* AwBrowserContext::GetQuotaManagerBridge() { | 224 AwQuotaManagerBridge* AwBrowserContext::GetQuotaManagerBridge() { |
229 if (!quota_manager_bridge_.get()) { | 225 if (!quota_manager_bridge_.get()) { |
230 quota_manager_bridge_ = native_factory_->CreateAwQuotaManagerBridge(this); | 226 quota_manager_bridge_ = AwQuotaManagerBridge::Create(this); |
231 } | 227 } |
232 return quota_manager_bridge_.get(); | 228 return quota_manager_bridge_.get(); |
233 } | 229 } |
234 | 230 |
235 AwFormDatabaseService* AwBrowserContext::GetFormDatabaseService() { | 231 AwFormDatabaseService* AwBrowserContext::GetFormDatabaseService() { |
236 return form_database_service_.get(); | 232 return form_database_service_.get(); |
237 } | 233 } |
238 | 234 |
239 AwURLRequestContextGetter* AwBrowserContext::GetAwURLRequestContext() { | 235 AwURLRequestContextGetter* AwBrowserContext::GetAwURLRequestContext() { |
240 return url_request_context_getter_.get(); | 236 return url_request_context_getter_.get(); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 | 398 |
403 void AwBrowserContext::RebuildTable( | 399 void AwBrowserContext::RebuildTable( |
404 const scoped_refptr<URLEnumerator>& enumerator) { | 400 const scoped_refptr<URLEnumerator>& enumerator) { |
405 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 401 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
406 // can change in the lifetime of this WebView and may not yet be set here. | 402 // can change in the lifetime of this WebView and may not yet be set here. |
407 // Therefore this initialization path is not used. | 403 // Therefore this initialization path is not used. |
408 enumerator->OnComplete(true); | 404 enumerator->OnComplete(true); |
409 } | 405 } |
410 | 406 |
411 } // namespace android_webview | 407 } // namespace android_webview |
OLD | NEW |