| 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_array.h" |
| 10 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
| 11 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/strings/string16.h" |
| 12 #include "content/browser/frame_host/navigation_controller_impl.h" | 14 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 13 #include "content/browser/frame_host/navigation_entry_impl.h" | 15 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 14 #include "content/public/browser/browser_context.h" | 16 #include "content/public/browser/browser_context.h" |
| 15 #include "content/public/browser/ssl_host_state_delegate.h" | 17 #include "content/public/browser/ssl_host_state_delegate.h" |
| 16 #include "content/public/common/resource_request_body.h" | 18 #include "content/public/common/resource_request_body.h" |
| 17 #include "jni/NavigationControllerImpl_jni.h" | 19 #include "jni/NavigationControllerImpl_jni.h" |
| 18 #include "net/base/data_url.h" | 20 #include "net/base/data_url.h" |
| 19 #include "ui/gfx/android/java_bitmap.h" | 21 #include "ui/gfx/android/java_bitmap.h" |
| 20 | 22 |
| 21 using base::android::AttachCurrentThread; | 23 using base::android::AttachCurrentThread; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 43 ConvertUTF8ToJavaString(env, entry->GetVirtualURL().spec())); | 45 ConvertUTF8ToJavaString(env, entry->GetVirtualURL().spec())); |
| 44 ScopedJavaLocalRef<jstring> j_original_url( | 46 ScopedJavaLocalRef<jstring> j_original_url( |
| 45 ConvertUTF8ToJavaString(env, entry->GetOriginalRequestURL().spec())); | 47 ConvertUTF8ToJavaString(env, entry->GetOriginalRequestURL().spec())); |
| 46 ScopedJavaLocalRef<jstring> j_title( | 48 ScopedJavaLocalRef<jstring> j_title( |
| 47 ConvertUTF16ToJavaString(env, entry->GetTitle())); | 49 ConvertUTF16ToJavaString(env, entry->GetTitle())); |
| 48 ScopedJavaLocalRef<jobject> j_bitmap; | 50 ScopedJavaLocalRef<jobject> j_bitmap; |
| 49 const content::FaviconStatus& status = entry->GetFavicon(); | 51 const content::FaviconStatus& status = entry->GetFavicon(); |
| 50 if (status.valid && status.image.ToSkBitmap()->getSize() > 0) | 52 if (status.valid && status.image.ToSkBitmap()->getSize() > 0) |
| 51 j_bitmap = gfx::ConvertToJavaBitmap(status.image.ToSkBitmap()); | 53 j_bitmap = gfx::ConvertToJavaBitmap(status.image.ToSkBitmap()); |
| 52 | 54 |
| 55 std::map<std::string, base::string16> extra_data; |
| 56 entry->GetExtraData(&extra_data); |
| 57 std::vector<std::string> extra_data_keys; |
| 58 std::vector<base::string16> extra_data_values; |
| 59 for (const auto& entry : extra_data) { |
| 60 extra_data_keys.push_back(entry.first); |
| 61 extra_data_values.push_back(entry.second); |
| 62 } |
| 63 ScopedJavaLocalRef<jobjectArray> j_extra_data_keys( |
| 64 base::android::ToJavaArrayOfStrings(env, extra_data_keys)); |
| 65 ScopedJavaLocalRef<jobjectArray> j_extra_data_values( |
| 66 base::android::ToJavaArrayOfStrings(env, extra_data_values)); |
| 67 |
| 53 return content::Java_NavigationControllerImpl_createNavigationEntry( | 68 return content::Java_NavigationControllerImpl_createNavigationEntry( |
| 54 env, index, j_url, j_virtual_url, j_original_url, j_title, j_bitmap, | 69 env, index, j_url, j_virtual_url, j_original_url, j_title, j_bitmap, |
| 55 entry->GetTransitionType()); | 70 entry->GetTransitionType(), j_extra_data_keys, j_extra_data_values); |
| 56 } | 71 } |
| 57 | 72 |
| 58 static void AddNavigationEntryToHistory(JNIEnv* env, | 73 static void AddNavigationEntryToHistory(JNIEnv* env, |
| 59 const JavaRef<jobject>& history, | 74 const JavaRef<jobject>& history, |
| 60 content::NavigationEntry* entry, | 75 content::NavigationEntry* entry, |
| 61 int index) { | 76 int index) { |
| 62 content::Java_NavigationControllerImpl_addToNavigationHistory( | 77 content::Java_NavigationControllerImpl_addToNavigationHistory( |
| 63 env, history, CreateJavaNavigationEntry(env, entry, index)); | 78 env, history, CreateJavaNavigationEntry(env, entry, index)); |
| 64 } | 79 } |
| 65 | 80 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 const JavaParamRef<jobject>& obj, | 436 const JavaParamRef<jobject>& obj, |
| 422 jlong source_navigation_controller_android, | 437 jlong source_navigation_controller_android, |
| 423 jboolean replace_entry) { | 438 jboolean replace_entry) { |
| 424 navigation_controller_->CopyStateFromAndPrune( | 439 navigation_controller_->CopyStateFromAndPrune( |
| 425 reinterpret_cast<NavigationControllerAndroid*>( | 440 reinterpret_cast<NavigationControllerAndroid*>( |
| 426 source_navigation_controller_android)->navigation_controller_, | 441 source_navigation_controller_android)->navigation_controller_, |
| 427 replace_entry); | 442 replace_entry); |
| 428 } | 443 } |
| 429 | 444 |
| 430 } // namespace content | 445 } // namespace content |
| OLD | NEW |