OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_DOCUMENT_DOCUMENT_WEB_CONTENTS_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_DOCUMENT_DOCUMENT_WEB_CONTENTS_DELEGATE_H_ |
| 7 |
| 8 #include "components/web_contents_delegate_android/web_contents_delegate_android
.h" |
| 9 |
| 10 // Stub WebContentsDelegateAndroid that is meant to be a temporary substitute |
| 11 // for a real WebContentsDelegate for the (expectedly short) period between when |
| 12 // a new WebContents is created and the new DocumentActivity/DocumentTab are |
| 13 // created and take ownership of the WebContents (which replaces this Delegate |
| 14 // with a real one). It is not meant to do anything except allow |
| 15 // WebContentsDelegateAndroid::OpenURLFromTab() to load the URL for the |
| 16 // WebContents. |
| 17 class DocumentWebContentsDelegate |
| 18 : public web_contents_delegate_android::WebContentsDelegateAndroid { |
| 19 public: |
| 20 DocumentWebContentsDelegate(JNIEnv* env, jobject obj); |
| 21 ~DocumentWebContentsDelegate() override; |
| 22 |
| 23 // Attaches this delegate to the given WebContents. |
| 24 void AttachContents(JNIEnv* env, jobject obj, jobject jweb_contents); |
| 25 |
| 26 // Registers the JNI calls. |
| 27 static bool Register(JNIEnv* env); |
| 28 |
| 29 // Overridden from WebContentsDelegate. |
| 30 void AddNewContents(content::WebContents* source, |
| 31 content::WebContents* new_contents, |
| 32 WindowOpenDisposition disposition, |
| 33 const gfx::Rect& initial_pos, |
| 34 bool user_gesture, |
| 35 bool* was_blocked) override; |
| 36 void CloseContents(content::WebContents* source) override; |
| 37 bool ShouldCreateWebContents( |
| 38 content::WebContents* web_contents, |
| 39 int route_id, |
| 40 int main_frame_route_id, |
| 41 WindowContainerType window_container_type, |
| 42 const base::string16& frame_name, |
| 43 const GURL& target_url, |
| 44 const std::string& partition_id, |
| 45 content::SessionStorageNamespace* session_storage_namespace) override; |
| 46 }; |
| 47 |
| 48 #endif // CHROME_BROWSER_ANDROID_DOCUMENT_DOCUMENT_WEB_CONTENTS_DELEGATE_H_ |
OLD | NEW |