OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/frame_host/navigation_controller_android.h" | 5 #include "content/browser/frame_host/navigation_controller_android.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/strings/string16.h" |
12 #include "content/browser/frame_host/navigation_controller_impl.h" | 13 #include "content/browser/frame_host/navigation_controller_impl.h" |
13 #include "content/browser/frame_host/navigation_entry_impl.h" | 14 #include "content/browser/frame_host/navigation_entry_impl.h" |
14 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
15 #include "content/public/browser/ssl_host_state_delegate.h" | 16 #include "content/public/browser/ssl_host_state_delegate.h" |
16 #include "content/public/common/resource_request_body.h" | 17 #include "content/public/common/resource_request_body.h" |
17 #include "jni/NavigationControllerImpl_jni.h" | 18 #include "jni/NavigationControllerImpl_jni.h" |
18 #include "net/base/data_url.h" | 19 #include "net/base/data_url.h" |
19 #include "ui/gfx/android/java_bitmap.h" | 20 #include "ui/gfx/android/java_bitmap.h" |
20 | 21 |
21 using base::android::AttachCurrentThread; | 22 using base::android::AttachCurrentThread; |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 JNIEnv* env, | 414 JNIEnv* env, |
414 const JavaParamRef<jobject>& obj, | 415 const JavaParamRef<jobject>& obj, |
415 jlong source_navigation_controller_android, | 416 jlong source_navigation_controller_android, |
416 jboolean replace_entry) { | 417 jboolean replace_entry) { |
417 navigation_controller_->CopyStateFromAndPrune( | 418 navigation_controller_->CopyStateFromAndPrune( |
418 reinterpret_cast<NavigationControllerAndroid*>( | 419 reinterpret_cast<NavigationControllerAndroid*>( |
419 source_navigation_controller_android)->navigation_controller_, | 420 source_navigation_controller_android)->navigation_controller_, |
420 replace_entry); | 421 replace_entry); |
421 } | 422 } |
422 | 423 |
| 424 ScopedJavaLocalRef<jstring> NavigationControllerAndroid::GetEntryExtraData( |
| 425 JNIEnv* env, |
| 426 const JavaParamRef<jobject>& obj, |
| 427 jint index, |
| 428 const JavaParamRef<jstring>& jkey) { |
| 429 if (index < 0 || index >= navigation_controller_->GetEntryCount()) |
| 430 return ScopedJavaLocalRef<jstring>(); |
| 431 |
| 432 std::string key = base::android::ConvertJavaStringToUTF8(env, jkey); |
| 433 base::string16 value; |
| 434 navigation_controller_->GetEntryAtIndex(index)->GetExtraData(key, &value); |
| 435 return ConvertUTF16ToJavaString(env, value); |
| 436 } |
| 437 |
| 438 void NavigationControllerAndroid::SetEntryExtraData( |
| 439 JNIEnv* env, |
| 440 const JavaParamRef<jobject>& obj, |
| 441 jint index, |
| 442 const JavaParamRef<jstring>& jkey, |
| 443 const JavaParamRef<jstring>& jvalue) { |
| 444 if (index < 0 || index >= navigation_controller_->GetEntryCount()) |
| 445 return; |
| 446 |
| 447 std::string key = base::android::ConvertJavaStringToUTF8(env, jkey); |
| 448 base::string16 value = base::android::ConvertJavaStringToUTF16(env, jvalue); |
| 449 navigation_controller_->GetEntryAtIndex(index)->SetExtraData(key, value); |
| 450 } |
| 451 |
423 } // namespace content | 452 } // namespace content |
OLD | NEW |