OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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_TAB_BASE_ANDROID_IMPL_H_ |
| 6 #define CHROME_BROWSER_ANDROID_TAB_BASE_ANDROID_IMPL_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/browser/android/tab_android.h" |
| 13 |
| 14 namespace browser_sync { |
| 15 class SyncedTabDelegate; |
| 16 } |
| 17 |
| 18 namespace chrome { |
| 19 namespace android { |
| 20 class ChromeWebContentsDelegateAndroid; |
| 21 } |
| 22 } |
| 23 |
| 24 namespace content { |
| 25 class WebContents; |
| 26 } |
| 27 |
| 28 namespace WebKit { |
| 29 class WebLayer; |
| 30 } |
| 31 |
| 32 class TabBaseAndroidImpl : public TabAndroid { |
| 33 public: |
| 34 TabBaseAndroidImpl(JNIEnv* env, |
| 35 jobject obj, |
| 36 content::WebContents* web_contents); |
| 37 void Destroy(JNIEnv* env, jobject obj); |
| 38 |
| 39 WebKit::WebLayer* tab_layer() const { return tab_layer_.get(); } |
| 40 |
| 41 // -------------------------------------------------------------------------- |
| 42 // TabAndroid Methods |
| 43 // -------------------------------------------------------------------------- |
| 44 virtual browser_sync::SyncedTabDelegate* GetSyncedTabDelegate() OVERRIDE; |
| 45 |
| 46 virtual void OnReceivedHttpAuthRequest(jobject auth_handler, |
| 47 const string16& host, |
| 48 const string16& realm) OVERRIDE; |
| 49 virtual void ShowContextMenu( |
| 50 const content::ContextMenuParams& params) OVERRIDE; |
| 51 |
| 52 virtual void ShowCustomContextMenu( |
| 53 const content::ContextMenuParams& params, |
| 54 const base::Callback<void(int)>& callback) OVERRIDE; |
| 55 |
| 56 virtual void ShowSelectFileDialog( |
| 57 const base::android::ScopedJavaLocalRef<jobject>& select_file) OVERRIDE; |
| 58 |
| 59 virtual void AddShortcutToBookmark(const GURL& url, |
| 60 const string16& title, |
| 61 const SkBitmap& skbitmap, |
| 62 int r_value, |
| 63 int g_value, |
| 64 int b_value) OVERRIDE; |
| 65 |
| 66 // Called when the common ExternalProtocolHandler wants to |
| 67 // run the external protocol dialog. |
| 68 virtual void RunExternalProtocolDialog(const GURL& url) OVERRIDE; |
| 69 |
| 70 // Register the Tab's native methods through JNI. |
| 71 static bool RegisterTabBaseAndroidImpl(JNIEnv* env); |
| 72 |
| 73 // -------------------------------------------------------------------------- |
| 74 // Methods called from Java via JNI |
| 75 // -------------------------------------------------------------------------- |
| 76 void InitWebContentsDelegate(JNIEnv* env, |
| 77 jobject obj, |
| 78 jobject web_contents_delegate); |
| 79 |
| 80 base::android::ScopedJavaLocalRef<jstring> FixupUrl(JNIEnv* env, |
| 81 jobject obj, |
| 82 jstring url); |
| 83 |
| 84 protected: |
| 85 virtual ~TabBaseAndroidImpl(); |
| 86 |
| 87 private: |
| 88 scoped_ptr<content::WebContents> web_contents_; |
| 89 scoped_ptr<WebKit::WebLayer> tab_layer_; |
| 90 scoped_ptr<chrome::android::ChromeWebContentsDelegateAndroid> |
| 91 web_contents_delegate_; |
| 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(TabBaseAndroidImpl); |
| 94 }; |
| 95 |
| 96 #endif // CHROME_BROWSER_ANDROID_TAB_BASE_ANDROID_IMPL_H_ |
OLD | NEW |