OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/native/cookie_manager.h" | 5 #include "android_webview/native/cookie_manager.h" |
6 | 6 |
7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
8 #include "android_webview/browser/aw_cookie_access_policy.h" | 8 #include "android_webview/browser/aw_cookie_access_policy.h" |
9 #include "android_webview/browser/net/init_native_callback.h" | 9 #include "android_webview/browser/net/init_native_callback.h" |
10 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" | 10 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" |
11 #include "android_webview/native/aw_browser_dependency_factory.h" | 11 #include "android_webview/native/aw_browser_dependency_factory.h" |
12 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
13 #include "base/android/path_utils.h" | 13 #include "base/android/path_utils.h" |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
18 #include "base/lazy_instance.h" | 18 #include "base/lazy_instance.h" |
19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
20 #include "base/message_loop/message_loop_proxy.h" | 20 #include "base/message_loop/message_loop_proxy.h" |
21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
23 #include "base/synchronization/waitable_event.h" | 23 #include "base/synchronization/waitable_event.h" |
24 #include "base/threading/sequenced_worker_pool.h" | 24 #include "base/threading/sequenced_worker_pool.h" |
25 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
26 #include "base/threading/thread_restrictions.h" | 26 #include "base/threading/thread_restrictions.h" |
27 #include "content/public/browser/browser_context.h" | 27 #include "content/public/browser/browser_context.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 29 #include "content/public/browser/cookie_crypto_delegate.h" |
29 #include "content/public/browser/cookie_store_factory.h" | 30 #include "content/public/browser/cookie_store_factory.h" |
30 #include "content/public/common/url_constants.h" | 31 #include "content/public/common/url_constants.h" |
31 #include "jni/AwCookieManager_jni.h" | 32 #include "jni/AwCookieManager_jni.h" |
32 #include "net/cookies/cookie_monster.h" | 33 #include "net/cookies/cookie_monster.h" |
33 #include "net/cookies/cookie_options.h" | 34 #include "net/cookies/cookie_options.h" |
34 #include "net/url_request/url_request_context.h" | 35 #include "net/url_request/url_request_context.h" |
35 | 36 |
36 using base::FilePath; | 37 using base::FilePath; |
37 using base::android::ConvertJavaStringToUTF8; | 38 using base::android::ConvertJavaStringToUTF8; |
38 using base::android::ConvertJavaStringToUTF16; | 39 using base::android::ConvertJavaStringToUTF16; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 background_task_runner->PostTask( | 184 background_task_runner->PostTask( |
184 FROM_HERE, | 185 FROM_HERE, |
185 base::Bind(ImportLegacyCookieStore, cookie_store_path)); | 186 base::Bind(ImportLegacyCookieStore, cookie_store_path)); |
186 | 187 |
187 net::CookieStore* cookie_store = content::CreatePersistentCookieStore( | 188 net::CookieStore* cookie_store = content::CreatePersistentCookieStore( |
188 cookie_store_path, | 189 cookie_store_path, |
189 true, | 190 true, |
190 NULL, | 191 NULL, |
191 NULL, | 192 NULL, |
192 client_task_runner, | 193 client_task_runner, |
193 background_task_runner); | 194 background_task_runner, |
| 195 scoped_ptr<content::CookieCryptoDelegate>()); |
194 cookie_monster_ = cookie_store->GetCookieMonster(); | 196 cookie_monster_ = cookie_store->GetCookieMonster(); |
195 cookie_monster_->SetPersistSessionCookies(true); | 197 cookie_monster_->SetPersistSessionCookies(true); |
196 SetAcceptFileSchemeCookiesLocked(kDefaultFileSchemeAllowed); | 198 SetAcceptFileSchemeCookiesLocked(kDefaultFileSchemeAllowed); |
197 } | 199 } |
198 | 200 |
199 void CookieManager::EnsureCookieMonsterExistsLocked() { | 201 void CookieManager::EnsureCookieMonsterExistsLocked() { |
200 cookie_monster_lock_.AssertAcquired(); | 202 cookie_monster_lock_.AssertAcquired(); |
201 if (cookie_monster_.get()) { | 203 if (cookie_monster_.get()) { |
202 return; | 204 return; |
203 } | 205 } |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 AwBrowserContext* browser_context) { | 497 AwBrowserContext* browser_context) { |
496 return CookieManager::GetInstance()->CreateBrowserThreadCookieStore( | 498 return CookieManager::GetInstance()->CreateBrowserThreadCookieStore( |
497 browser_context); | 499 browser_context); |
498 } | 500 } |
499 | 501 |
500 bool RegisterCookieManager(JNIEnv* env) { | 502 bool RegisterCookieManager(JNIEnv* env) { |
501 return RegisterNativesImpl(env); | 503 return RegisterNativesImpl(env); |
502 } | 504 } |
503 | 505 |
504 } // android_webview namespace | 506 } // android_webview namespace |
OLD | NEW |