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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 static void SetCookieSync(JNIEnv* env, | 535 static void SetCookieSync(JNIEnv* env, |
536 jobject obj, | 536 jobject obj, |
537 jstring url, | 537 jstring url, |
538 jstring value) { | 538 jstring value) { |
539 GURL host(ConvertJavaStringToUTF16(env, url)); | 539 GURL host(ConvertJavaStringToUTF16(env, url)); |
540 std::string cookie_value(ConvertJavaStringToUTF8(env, value)); | 540 std::string cookie_value(ConvertJavaStringToUTF8(env, value)); |
541 | 541 |
542 CookieManager::GetInstance()->SetCookieSync(host, cookie_value); | 542 CookieManager::GetInstance()->SetCookieSync(host, cookie_value); |
543 } | 543 } |
544 | 544 |
545 static ScopedJavaLocalRef<jstring> GetCookie(JNIEnv* env, | 545 static jstring GetCookie(JNIEnv* env, jobject obj, jstring url) { |
546 jobject obj, | |
547 jstring url) { | |
548 GURL host(ConvertJavaStringToUTF16(env, url)); | 546 GURL host(ConvertJavaStringToUTF16(env, url)); |
549 | 547 |
550 return base::android::ConvertUTF8ToJavaString( | 548 return base::android::ConvertUTF8ToJavaString( |
551 env, CookieManager::GetInstance()->GetCookie(host)); | 549 env, |
| 550 CookieManager::GetInstance()->GetCookie(host)).Release(); |
552 } | 551 } |
553 | 552 |
554 static void RemoveSessionCookies(JNIEnv* env, | 553 static void RemoveSessionCookies(JNIEnv* env, |
555 jobject obj, | 554 jobject obj, |
556 jobject java_callback) { | 555 jobject java_callback) { |
557 scoped_ptr<BoolCookieCallbackHolder> callback( | 556 scoped_ptr<BoolCookieCallbackHolder> callback( |
558 new BoolCookieCallbackHolder(env, java_callback)); | 557 new BoolCookieCallbackHolder(env, java_callback)); |
559 CookieManager::GetInstance()->RemoveSessionCookies(callback.Pass()); | 558 CookieManager::GetInstance()->RemoveSessionCookies(callback.Pass()); |
560 } | 559 } |
561 | 560 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 scoped_refptr<net::CookieStore> CreateCookieStore( | 596 scoped_refptr<net::CookieStore> CreateCookieStore( |
598 AwBrowserContext* browser_context) { | 597 AwBrowserContext* browser_context) { |
599 return CookieManager::GetInstance()->GetCookieStore(); | 598 return CookieManager::GetInstance()->GetCookieStore(); |
600 } | 599 } |
601 | 600 |
602 bool RegisterCookieManager(JNIEnv* env) { | 601 bool RegisterCookieManager(JNIEnv* env) { |
603 return RegisterNativesImpl(env); | 602 return RegisterNativesImpl(env); |
604 } | 603 } |
605 | 604 |
606 } // android_webview namespace | 605 } // android_webview namespace |
OLD | NEW |