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/browser/cookie_manager.h" | 5 #include "android_webview/browser/cookie_manager.h" |
6 | 6 |
| 7 #include <cstdint> |
7 #include <memory> | 8 #include <memory> |
8 #include <utility> | 9 #include <utility> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "android_webview/browser/aw_browser_context.h" | 12 #include "android_webview/browser/aw_browser_context.h" |
12 #include "android_webview/browser/aw_cookie_access_policy.h" | 13 #include "android_webview/browser/aw_cookie_access_policy.h" |
13 #include "android_webview/browser/net/init_native_callback.h" | 14 #include "android_webview/browser/net/init_native_callback.h" |
14 #include "base/android/jni_string.h" | 15 #include "base/android/jni_string.h" |
15 #include "base/android/path_utils.h" | 16 #include "base/android/path_utils.h" |
16 #include "base/bind.h" | 17 #include "base/bind.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 200 |
200 void GetCookieValueAsyncHelper(const GURL& host, | 201 void GetCookieValueAsyncHelper(const GURL& host, |
201 std::string* result, | 202 std::string* result, |
202 base::Closure complete); | 203 base::Closure complete); |
203 void GetCookieValueCompleted(base::Closure complete, | 204 void GetCookieValueCompleted(base::Closure complete, |
204 std::string* result, | 205 std::string* result, |
205 const std::string& value); | 206 const std::string& value); |
206 | 207 |
207 void RemoveSessionCookiesHelper(BoolCallback callback); | 208 void RemoveSessionCookiesHelper(BoolCallback callback); |
208 void RemoveAllCookiesHelper(BoolCallback callback); | 209 void RemoveAllCookiesHelper(BoolCallback callback); |
209 void RemoveCookiesCompleted(BoolCallback callback, int num_deleted); | 210 void RemoveCookiesCompleted(BoolCallback callback, uint32_t num_deleted); |
210 | 211 |
211 void FlushCookieStoreAsyncHelper(base::Closure complete); | 212 void FlushCookieStoreAsyncHelper(base::Closure complete); |
212 | 213 |
213 void HasCookiesAsyncHelper(bool* result, base::Closure complete); | 214 void HasCookiesAsyncHelper(bool* result, base::Closure complete); |
214 void HasCookiesCompleted(base::Closure complete, | 215 void HasCookiesCompleted(base::Closure complete, |
215 bool* result, | 216 bool* result, |
216 const net::CookieList& cookies); | 217 const net::CookieList& cookies); |
217 | 218 |
218 // This protects the following two bools, as they're used on multiple threads. | 219 // This protects the following two bools, as they're used on multiple threads. |
219 base::Lock accept_file_scheme_cookies_lock_; | 220 base::Lock accept_file_scheme_cookies_lock_; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 base::Unretained(this))); | 442 base::Unretained(this))); |
442 } | 443 } |
443 | 444 |
444 void CookieManager::RemoveSessionCookiesHelper(BoolCallback callback) { | 445 void CookieManager::RemoveSessionCookiesHelper(BoolCallback callback) { |
445 GetCookieStore()->DeleteSessionCookiesAsync( | 446 GetCookieStore()->DeleteSessionCookiesAsync( |
446 base::Bind(&CookieManager::RemoveCookiesCompleted, base::Unretained(this), | 447 base::Bind(&CookieManager::RemoveCookiesCompleted, base::Unretained(this), |
447 callback)); | 448 callback)); |
448 } | 449 } |
449 | 450 |
450 void CookieManager::RemoveCookiesCompleted(BoolCallback callback, | 451 void CookieManager::RemoveCookiesCompleted(BoolCallback callback, |
451 int num_deleted) { | 452 uint32_t num_deleted) { |
452 callback.Run(num_deleted > 0); | 453 callback.Run(num_deleted > 0u); |
453 } | 454 } |
454 | 455 |
455 void CookieManager::RemoveAllCookies( | 456 void CookieManager::RemoveAllCookies( |
456 std::unique_ptr<BoolCookieCallbackHolder> callback_holder) { | 457 std::unique_ptr<BoolCookieCallbackHolder> callback_holder) { |
457 BoolCallback callback = | 458 BoolCallback callback = |
458 BoolCookieCallbackHolder::ConvertToCallback(std::move(callback_holder)); | 459 BoolCookieCallbackHolder::ConvertToCallback(std::move(callback_holder)); |
459 ExecCookieTask(base::Bind(&CookieManager::RemoveAllCookiesHelper, | 460 ExecCookieTask(base::Bind(&CookieManager::RemoveAllCookiesHelper, |
460 base::Unretained(this), callback)); | 461 base::Unretained(this), callback)); |
461 } | 462 } |
462 | 463 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 | 624 |
624 net::CookieStore* GetCookieStore() { | 625 net::CookieStore* GetCookieStore() { |
625 return CookieManager::GetInstance()->GetCookieStore(); | 626 return CookieManager::GetInstance()->GetCookieStore(); |
626 } | 627 } |
627 | 628 |
628 bool RegisterCookieManager(JNIEnv* env) { | 629 bool RegisterCookieManager(JNIEnv* env) { |
629 return RegisterNativesImpl(env); | 630 return RegisterNativesImpl(env); |
630 } | 631 } |
631 | 632 |
632 } // namespace android_webview | 633 } // namespace android_webview |
OLD | NEW |