| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // into a base callback. | 72 // into a base callback. |
| 73 class BoolCookieCallbackHolder { | 73 class BoolCookieCallbackHolder { |
| 74 public: | 74 public: |
| 75 BoolCookieCallbackHolder(JNIEnv* env, jobject callback) { | 75 BoolCookieCallbackHolder(JNIEnv* env, jobject callback) { |
| 76 callback_.Reset(env, callback); | 76 callback_.Reset(env, callback); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void Invoke(bool result) { | 79 void Invoke(bool result) { |
| 80 if (!callback_.is_null()) { | 80 if (!callback_.is_null()) { |
| 81 JNIEnv* env = base::android::AttachCurrentThread(); | 81 JNIEnv* env = base::android::AttachCurrentThread(); |
| 82 Java_AwCookieManager_invokeBooleanCookieCallback(env, callback_.obj(), | 82 Java_AwCookieManager_invokeBooleanCookieCallback(env, callback_, result); |
| 83 result); | |
| 84 } | 83 } |
| 85 } | 84 } |
| 86 | 85 |
| 87 static BoolCallback ConvertToCallback( | 86 static BoolCallback ConvertToCallback( |
| 88 std::unique_ptr<BoolCookieCallbackHolder> me) { | 87 std::unique_ptr<BoolCookieCallbackHolder> me) { |
| 89 return base::Bind(&BoolCookieCallbackHolder::Invoke, | 88 return base::Bind(&BoolCookieCallbackHolder::Invoke, |
| 90 base::Owned(me.release())); | 89 base::Owned(me.release())); |
| 91 } | 90 } |
| 92 | 91 |
| 93 private: | 92 private: |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 | 619 |
| 621 net::CookieStore* GetCookieStore() { | 620 net::CookieStore* GetCookieStore() { |
| 622 return CookieManager::GetInstance()->GetCookieStore(); | 621 return CookieManager::GetInstance()->GetCookieStore(); |
| 623 } | 622 } |
| 624 | 623 |
| 625 bool RegisterCookieManager(JNIEnv* env) { | 624 bool RegisterCookieManager(JNIEnv* env) { |
| 626 return RegisterNativesImpl(env); | 625 return RegisterNativesImpl(env); |
| 627 } | 626 } |
| 628 | 627 |
| 629 } // android_webview namespace | 628 } // android_webview namespace |
| OLD | NEW |