Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / components / web_contents_delegate_android / web_contents_delegate_android.cc
index 9e6e15e..629cd06 100644 (file)
@@ -20,7 +20,6 @@
 #include "content/public/browser/page_navigator.h"
 #include "content/public/browser/render_widget_host_view.h"
 #include "content/public/browser/web_contents.h"
-#include "content/public/common/page_transition_types.h"
 #include "content/public/common/referrer.h"
 #include "jni/WebContentsDelegateAndroid_jni.h"
 #include "ui/base/window_open_disposition.h"
@@ -217,6 +216,58 @@ void WebContentsDelegateAndroid::RendererResponsive(WebContents* source) {
   Java_WebContentsDelegateAndroid_rendererResponsive(env, obj.obj());
 }
 
+void WebContentsDelegateAndroid::DidNavigateToPendingEntry(
+    WebContents* source) {
+  JNIEnv* env = AttachCurrentThread();
+  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
+  if (obj.is_null())
+    return;
+  Java_WebContentsDelegateAndroid_didNavigateToPendingEntry(env, obj.obj());
+}
+
+bool WebContentsDelegateAndroid::ShouldCreateWebContents(
+    WebContents* web_contents,
+    int route_id,
+    WindowContainerType window_container_type,
+    const base::string16& frame_name,
+    const GURL& target_url,
+    const std::string& partition_id,
+    content::SessionStorageNamespace* session_storage_namespace) {
+  JNIEnv* env = AttachCurrentThread();
+  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
+  if (obj.is_null())
+    return true;
+  ScopedJavaLocalRef<jstring> java_url =
+      ConvertUTF8ToJavaString(env, target_url.spec());
+  return Java_WebContentsDelegateAndroid_shouldCreateWebContents(env, obj.obj(),
+      java_url.obj());
+}
+
+bool WebContentsDelegateAndroid::OnGoToEntryOffset(int offset) {
+  JNIEnv* env = AttachCurrentThread();
+  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
+  if (obj.is_null())
+    return true;
+  return Java_WebContentsDelegateAndroid_onGoToEntryOffset(env, obj.obj(),
+      offset);
+}
+
+void WebContentsDelegateAndroid::WebContentsCreated(
+    WebContents* source_contents, int opener_render_frame_id,
+    const base::string16& frame_name, const GURL& target_url,
+    WebContents* new_contents) {
+  JNIEnv* env = AttachCurrentThread();
+  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
+  if (obj.is_null())
+    return;
+  Java_WebContentsDelegateAndroid_webContentsCreated(env, obj.obj(),
+      reinterpret_cast<intptr_t>(source_contents),
+      opener_render_frame_id,
+      base::android::ConvertUTF16ToJavaString(env, frame_name).Release(),
+      base::android::ConvertUTF8ToJavaString(env, target_url.spec()).Release(),
+      reinterpret_cast<intptr_t>(new_contents));
+}
+
 void WebContentsDelegateAndroid::CloseContents(WebContents* source) {
   JNIEnv* env = AttachCurrentThread();
   ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
@@ -276,7 +327,6 @@ bool WebContentsDelegateAndroid::AddMessageToConsole(
 // navigation. So we only handle the first case and pass the source TabContents'
 // url to Java to update the UI.
 void WebContentsDelegateAndroid::UpdateTargetURL(WebContents* source,
-                                                 int32 page_id,
                                                  const GURL& url) {
   if (!url.is_empty())
     return;
@@ -320,12 +370,7 @@ void WebContentsDelegateAndroid::ShowRepostFormWarningDialog(
   ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
   if (obj.is_null())
     return;
-  ScopedJavaLocalRef<jobject> content_view_core =
-      content::ContentViewCore::FromWebContents(source)->GetJavaObject();
-  if (content_view_core.is_null())
-    return;
-  Java_WebContentsDelegateAndroid_showRepostFormWarningDialog(env, obj.obj(),
-      content_view_core.obj());
+  Java_WebContentsDelegateAndroid_showRepostFormWarningDialog(env, obj.obj());
 }
 
 void WebContentsDelegateAndroid::ToggleFullscreenModeForTab(