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" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const FilePath& user_data_dir, | 178 const FilePath& user_data_dir, |
179 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner, | 179 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner, |
180 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner) { | 180 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner) { |
181 FilePath cookie_store_path = | 181 FilePath cookie_store_path = |
182 user_data_dir.Append(FILE_PATH_LITERAL("Cookies")); | 182 user_data_dir.Append(FILE_PATH_LITERAL("Cookies")); |
183 | 183 |
184 background_task_runner->PostTask( | 184 background_task_runner->PostTask( |
185 FROM_HERE, | 185 FROM_HERE, |
186 base::Bind(ImportLegacyCookieStore, cookie_store_path)); | 186 base::Bind(ImportLegacyCookieStore, cookie_store_path)); |
187 | 187 |
188 net::CookieStore* cookie_store = content::CreatePersistentCookieStore( | 188 content::CookieStoreConfig cookie_config( |
189 cookie_store_path, | 189 cookie_store_path, |
190 true, | 190 content::CookieStoreConfig::RESTORED_SESSION_COOKIES, |
191 NULL, | 191 NULL, NULL); |
192 NULL, | 192 cookie_config.client_task_runner = client_task_runner; |
193 client_task_runner, | 193 cookie_config.background_task_runner = background_task_runner; |
194 background_task_runner, | 194 net::CookieStore* cookie_store = content::CreateCookieStore(cookie_config); |
195 scoped_ptr<content::CookieCryptoDelegate>()); | |
196 cookie_monster_ = cookie_store->GetCookieMonster(); | 195 cookie_monster_ = cookie_store->GetCookieMonster(); |
197 cookie_monster_->SetPersistSessionCookies(true); | |
198 SetAcceptFileSchemeCookiesLocked(kDefaultFileSchemeAllowed); | 196 SetAcceptFileSchemeCookiesLocked(kDefaultFileSchemeAllowed); |
199 } | 197 } |
200 | 198 |
201 void CookieManager::EnsureCookieMonsterExistsLocked() { | 199 void CookieManager::EnsureCookieMonsterExistsLocked() { |
202 cookie_monster_lock_.AssertAcquired(); | 200 cookie_monster_lock_.AssertAcquired(); |
203 if (cookie_monster_.get()) { | 201 if (cookie_monster_.get()) { |
204 return; | 202 return; |
205 } | 203 } |
206 | 204 |
207 // Create cookie monster using WebView-specific threads, as the rest of the | 205 // Create cookie monster using WebView-specific threads, as the rest of the |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 AwBrowserContext* browser_context) { | 495 AwBrowserContext* browser_context) { |
498 return CookieManager::GetInstance()->CreateBrowserThreadCookieStore( | 496 return CookieManager::GetInstance()->CreateBrowserThreadCookieStore( |
499 browser_context); | 497 browser_context); |
500 } | 498 } |
501 | 499 |
502 bool RegisterCookieManager(JNIEnv* env) { | 500 bool RegisterCookieManager(JNIEnv* env) { |
503 return RegisterNativesImpl(env); | 501 return RegisterNativesImpl(env); |
504 } | 502 } |
505 | 503 |
506 } // android_webview namespace | 504 } // android_webview namespace |
OLD | NEW |