OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_UI_ANDROID_TAB_MODEL_TAB_MODEL_BASE_H_ |
| 6 #define CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_BASE_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/android/jni_weak_ref.h" |
| 12 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/compiler_specific.h" |
| 14 #include "base/logging.h" |
| 15 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
| 16 |
| 17 class Profile; |
| 18 class TabAndroid; |
| 19 |
| 20 namespace content { |
| 21 class WebContents; |
| 22 } |
| 23 |
| 24 // Native representation of TabModelBase which provides access to information |
| 25 // about a tabstrip to native code and could potentially be used in place of |
| 26 // Browser for some functionality in Clank. |
| 27 class TabModelBase : public TabModel { |
| 28 public: |
| 29 TabModelBase(JNIEnv* env, jobject obj, Profile* profile); |
| 30 void Destroy(JNIEnv* env, jobject obj); |
| 31 |
| 32 // Called by JNI |
| 33 base::android::ScopedJavaLocalRef<jobject> GetProfileAndroid(JNIEnv* env, |
| 34 jobject obj); |
| 35 void TabAddedToModel(JNIEnv* env, jobject obj, jobject jtab); |
| 36 |
| 37 // TabModel: |
| 38 virtual int GetTabCount() const OVERRIDE; |
| 39 virtual int GetActiveIndex() const OVERRIDE; |
| 40 virtual content::WebContents* GetWebContentsAt(int index) const OVERRIDE; |
| 41 virtual TabAndroid* GetTabAt(int index) const OVERRIDE; |
| 42 |
| 43 virtual void SetActiveIndex(int index) OVERRIDE; |
| 44 virtual void CloseTabAt(int index) OVERRIDE; |
| 45 |
| 46 virtual void CreateTab(content::WebContents* web_contents, |
| 47 int parent_tab_id) OVERRIDE; |
| 48 virtual content::WebContents* CreateNewTabForDevTools( |
| 49 const GURL& url) OVERRIDE; |
| 50 |
| 51 // Return true if we are currently restoring sessions asynchronously. |
| 52 virtual bool IsSessionRestoreInProgress() const OVERRIDE; |
| 53 virtual void OpenClearBrowsingData() const OVERRIDE; |
| 54 |
| 55 // Instructs the TabModel to broadcast a notification that all tabs are now |
| 56 // loaded from storage. |
| 57 void BroadcastSessionRestoreComplete(JNIEnv* env, jobject obj); |
| 58 |
| 59 private: |
| 60 virtual ~TabModelBase(); |
| 61 |
| 62 JavaObjectWeakGlobalRef java_object_; |
| 63 }; |
| 64 |
| 65 // Register the Tab's native methods through jni. |
| 66 bool RegisterTabModelBase(JNIEnv* env); |
| 67 |
| 68 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_BASE_H_ |
OLD | NEW |