Index: chrome/browser/android/document/document_web_contents_delegate.cc |
diff --git a/chrome/browser/android/document/document_web_contents_delegate.cc b/chrome/browser/android/document/document_web_contents_delegate.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..760720fca5d927ff707cbb51af88cc5b98631b83 |
--- /dev/null |
+++ b/chrome/browser/android/document/document_web_contents_delegate.cc |
@@ -0,0 +1,61 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/android/document/document_web_contents_delegate.h" |
+ |
+#include "components/web_contents_delegate_android/web_contents_delegate_android.h" |
+#include "content/public/browser/web_contents.h" |
+#include "jni/DocumentWebContentsDelegate_jni.h" |
+ |
+DocumentWebContentsDelegate::DocumentWebContentsDelegate(JNIEnv* env, |
+ jobject obj) |
+ : WebContentsDelegateAndroid(env, obj) { |
+} |
+ |
+DocumentWebContentsDelegate::~DocumentWebContentsDelegate() { |
+} |
+ |
+void DocumentWebContentsDelegate::AttachContents(JNIEnv* env, |
+ jobject jcaller, |
+ jobject jweb_contents) { |
+ content::WebContents* web_contents = |
+ content::WebContents::FromJavaWebContents(jweb_contents); |
+ web_contents->SetDelegate(this); |
+} |
+ |
+bool DocumentWebContentsDelegate::Register(JNIEnv* env) { |
+ return RegisterNativesImpl(env); |
+} |
+ |
+void DocumentWebContentsDelegate::AddNewContents( |
+ content::WebContents* source, |
+ content::WebContents* new_contents, |
+ WindowOpenDisposition disposition, |
+ const gfx::Rect& initial_pos, |
+ bool user_gesture, |
+ bool* was_blocked) { |
+ NOTREACHED(); |
+} |
+ |
+void DocumentWebContentsDelegate::CloseContents(content::WebContents* source) { |
+ NOTREACHED(); |
+} |
+ |
+bool DocumentWebContentsDelegate::ShouldCreateWebContents( |
+ content::WebContents* web_contents, |
+ int route_id, |
+ int main_frame_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) { |
+ NOTREACHED(); |
+ return false; |
+} |
+ |
+ |
+static jlong Initialize(JNIEnv* env, jobject obj) { |
+ return reinterpret_cast<intptr_t>(new DocumentWebContentsDelegate(env, obj)); |
+} |