| 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/jni_dependency_factory.h" | 10 #include "android_webview/browser/jni_dependency_factory.h" |
| 11 #include "android_webview/browser/net/aw_url_request_context_getter.h" | 11 #include "android_webview/browser/net/aw_url_request_context_getter.h" |
| 12 #include "base/prefs/pref_registry_simple.h" | 12 #include "base/prefs/pref_registry_simple.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "base/prefs/pref_service_builder.h" | 14 #include "base/prefs/pref_service_builder.h" |
| 15 #include "components/autofill/core/common/autofill_pref_names.h" | 15 #include "components/autofill/core/common/autofill_pref_names.h" |
| 16 #include "components/user_prefs/user_prefs.h" | 16 #include "components/user_prefs/user_prefs.h" |
| 17 #include "components/visitedlink/browser/visitedlink_master.h" | 17 #include "components/visitedlink/browser/visitedlink_master.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/cookie_store_factory.h" |
| 19 #include "content/public/browser/resource_context.h" | 20 #include "content/public/browser/resource_context.h" |
| 20 #include "content/public/browser/storage_partition.h" | 21 #include "content/public/browser/storage_partition.h" |
| 21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 22 #include "net/url_request/url_request_context.h" | 23 #include "net/url_request/url_request_context.h" |
| 23 | 24 |
| 24 namespace android_webview { | 25 namespace android_webview { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 // Shows notifications which correspond to PersistentPrefStore's reading errors. | 29 // Shows notifications which correspond to PersistentPrefStore's reading errors. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 visitedlink_master_->Init(); | 102 visitedlink_master_->Init(); |
| 102 } | 103 } |
| 103 | 104 |
| 104 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 105 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
| 105 DCHECK(visitedlink_master_); | 106 DCHECK(visitedlink_master_); |
| 106 visitedlink_master_->AddURLs(urls); | 107 visitedlink_master_->AddURLs(urls); |
| 107 } | 108 } |
| 108 | 109 |
| 109 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( | 110 net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( |
| 110 content::ProtocolHandlerMap* protocol_handlers) { | 111 content::ProtocolHandlerMap* protocol_handlers) { |
| 112 // TODO(ajwong): The whole interaction between |
| 113 // BrowserThreadDelegate::Init(), StoragePartition, and OverrideCookieStoreMap |
| 114 // is confusing. |
| 111 CHECK(url_request_context_getter_.get()); | 115 CHECK(url_request_context_getter_.get()); |
| 112 url_request_context_getter_->SetProtocolHandlers(protocol_handlers); | 116 url_request_context_getter_->SetProtocolHandlers(protocol_handlers); |
| 113 return url_request_context_getter_.get(); | 117 return url_request_context_getter_.get(); |
| 114 } | 118 } |
| 115 | 119 |
| 116 net::URLRequestContextGetter* | 120 net::URLRequestContextGetter* |
| 117 AwBrowserContext::CreateRequestContextForStoragePartition( | 121 AwBrowserContext::CreateRequestContextForStoragePartition( |
| 118 const base::FilePath& partition_path, | 122 const base::FilePath& partition_path, |
| 119 bool in_memory, | 123 bool in_memory, |
| 120 content::ProtocolHandlerMap* protocol_handlers) { | 124 content::ProtocolHandlerMap* protocol_handlers) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 169 |
| 166 base::FilePath AwBrowserContext::GetPath() const { | 170 base::FilePath AwBrowserContext::GetPath() const { |
| 167 return context_storage_path_; | 171 return context_storage_path_; |
| 168 } | 172 } |
| 169 | 173 |
| 170 bool AwBrowserContext::IsOffTheRecord() const { | 174 bool AwBrowserContext::IsOffTheRecord() const { |
| 171 // Android WebView does not support off the record profile yet. | 175 // Android WebView does not support off the record profile yet. |
| 172 return false; | 176 return false; |
| 173 } | 177 } |
| 174 | 178 |
| 179 content::CookieStoreConfig AwBrowserContext::GetCookieStoreConfig() { |
| 180 return content::CookieStoreConfig::Persistent( |
| 181 GetPath().Append(kCookieFilename), |
| 182 content::CookieStoreConfig::RESTORED_SESSION_COOKIES); |
| 183 } |
| 184 |
| 175 net::URLRequestContextGetter* AwBrowserContext::GetRequestContext() { | 185 net::URLRequestContextGetter* AwBrowserContext::GetRequestContext() { |
| 176 return GetDefaultStoragePartition(this)->GetURLRequestContext(); | 186 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
| 177 } | 187 } |
| 178 | 188 |
| 179 net::URLRequestContextGetter* | 189 net::URLRequestContextGetter* |
| 180 AwBrowserContext::GetRequestContextForRenderProcess( | 190 AwBrowserContext::GetRequestContextForRenderProcess( |
| 181 int renderer_child_id) { | 191 int renderer_child_id) { |
| 182 return GetRequestContext(); | 192 return GetRequestContext(); |
| 183 } | 193 } |
| 184 | 194 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 240 } |
| 231 return geolocation_permission_context_.get(); | 241 return geolocation_permission_context_.get(); |
| 232 } | 242 } |
| 233 | 243 |
| 234 quota::SpecialStoragePolicy* AwBrowserContext::GetSpecialStoragePolicy() { | 244 quota::SpecialStoragePolicy* AwBrowserContext::GetSpecialStoragePolicy() { |
| 235 // TODO(boliu): Implement this so we are not relying on default behavior. | 245 // TODO(boliu): Implement this so we are not relying on default behavior. |
| 236 NOTIMPLEMENTED(); | 246 NOTIMPLEMENTED(); |
| 237 return NULL; | 247 return NULL; |
| 238 } | 248 } |
| 239 | 249 |
| 250 void AwBrowserContext::OverrideCookieStoreMap( |
| 251 bool in_memory, |
| 252 const base::FilePath& partition_path, |
| 253 bool is_default, |
| 254 CookieStoreMap* cookie_store_map) { |
| 255 } |
| 256 |
| 240 void AwBrowserContext::RebuildTable( | 257 void AwBrowserContext::RebuildTable( |
| 241 const scoped_refptr<URLEnumerator>& enumerator) { | 258 const scoped_refptr<URLEnumerator>& enumerator) { |
| 242 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 259 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
| 243 // can change in the lifetime of this WebView and may not yet be set here. | 260 // can change in the lifetime of this WebView and may not yet be set here. |
| 244 // Therefore this initialization path is not used. | 261 // Therefore this initialization path is not used. |
| 245 enumerator->OnComplete(true); | 262 enumerator->OnComplete(true); |
| 246 } | 263 } |
| 247 | 264 |
| 248 } // namespace android_webview | 265 } // namespace android_webview |
| OLD | NEW |