| Index: content/browser/frame_host/navigation_controller_android.cc
|
| diff --git a/content/browser/frame_host/navigation_controller_android.cc b/content/browser/frame_host/navigation_controller_android.cc
|
| index 4f3f45a684f393ae7777c948f04b77d3378ed0bc..6fbe17e8dfb7f94d879197482cda0143178d7d6b 100644
|
| --- a/content/browser/frame_host/navigation_controller_android.cc
|
| +++ b/content/browser/frame_host/navigation_controller_android.cc
|
| @@ -22,11 +22,12 @@ using base::android::ConvertUTF8ToJavaString;
|
| namespace {
|
|
|
| // static
|
| -static void AddNavigationEntryToHistory(JNIEnv* env,
|
| - jobject obj,
|
| - jobject history,
|
| - content::NavigationEntry* entry,
|
| - int index) {
|
| +static base::android::ScopedJavaLocalRef<jobject> CreateJavaNavigationEntry(
|
| + JNIEnv* env,
|
| + content::NavigationEntry* entry,
|
| + int index) {
|
| + DCHECK(entry);
|
| +
|
| // Get the details of the current entry
|
| ScopedJavaLocalRef<jstring> j_url(
|
| ConvertUTF8ToJavaString(env, entry->GetURL().spec()));
|
| @@ -41,11 +42,8 @@ static void AddNavigationEntryToHistory(JNIEnv* env,
|
| if (status.valid && status.image.ToSkBitmap()->getSize() > 0)
|
| j_bitmap = gfx::ConvertToJavaBitmap(status.image.ToSkBitmap());
|
|
|
| - // Add the item to the list
|
| - content::Java_NavigationControllerImpl_addToNavigationHistory(
|
| + return content::Java_NavigationControllerImpl_createNavigationEntry(
|
| env,
|
| - obj,
|
| - history,
|
| index,
|
| j_url.obj(),
|
| j_virtual_url.obj(),
|
| @@ -54,6 +52,16 @@ static void AddNavigationEntryToHistory(JNIEnv* env,
|
| j_bitmap.obj());
|
| }
|
|
|
| +static void AddNavigationEntryToHistory(JNIEnv* env,
|
| + jobject history,
|
| + content::NavigationEntry* entry,
|
| + int index) {
|
| + content::Java_NavigationControllerImpl_addToNavigationHistory(
|
| + env,
|
| + history,
|
| + CreateJavaNavigationEntry(env, entry, index).obj());
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace content {
|
| @@ -216,7 +224,7 @@ jint NavigationControllerAndroid::GetNavigationHistory(JNIEnv* env,
|
| int count = navigation_controller_->GetEntryCount();
|
| for (int i = 0; i < count; ++i) {
|
| AddNavigationEntryToHistory(
|
| - env, obj, history, navigation_controller_->GetEntryAtIndex(i), i);
|
| + env, history, navigation_controller_->GetEntryAtIndex(i), i);
|
| }
|
|
|
| return navigation_controller_->GetCurrentEntryIndex();
|
| @@ -239,7 +247,7 @@ void NavigationControllerAndroid::GetDirectedNavigationHistory(
|
| break;
|
|
|
| AddNavigationEntryToHistory(
|
| - env, obj, history, navigation_controller_->GetEntryAtIndex(i), i);
|
| + env, history, navigation_controller_->GetEntryAtIndex(i), i);
|
| num_added++;
|
| }
|
| }
|
| @@ -292,4 +300,15 @@ void NavigationControllerAndroid::SetUseDesktopUserAgent(
|
| }
|
| }
|
|
|
| +base::android::ScopedJavaLocalRef<jobject>
|
| +NavigationControllerAndroid::GetPendingEntry(JNIEnv* env, jobject obj) {
|
| + content::NavigationEntry* entry = navigation_controller_->GetPendingEntry();
|
| +
|
| + if (!entry)
|
| + return base::android::ScopedJavaLocalRef<jobject>();
|
| +
|
| + return CreateJavaNavigationEntry(
|
| + env, entry, navigation_controller_->GetPendingEntryIndex());
|
| +}
|
| +
|
| } // namespace content
|
|
|