OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_ |
6 #define CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 class WebContents; | 21 class WebContents; |
22 } | 22 } |
23 | 23 |
24 // Bridges calls between the C++ and the Java TabModels. Functions in this | 24 // Bridges calls between the C++ and the Java TabModels. Functions in this |
25 // class should do little more than make calls out to the Java TabModel, which | 25 // class should do little more than make calls out to the Java TabModel, which |
26 // is what actually stores Tabs. | 26 // is what actually stores Tabs. |
27 class TabModelJniBridge : public TabModel { | 27 class TabModelJniBridge : public TabModel { |
28 public: | 28 public: |
29 TabModelJniBridge(JNIEnv* env, jobject obj, bool is_incognito); | 29 TabModelJniBridge(JNIEnv* env, jobject obj, bool is_incognito); |
30 void Destroy(JNIEnv* env, jobject obj); | 30 void Destroy(JNIEnv* env, jobject obj); |
31 virtual ~TabModelJniBridge(); | 31 ~TabModelJniBridge() override; |
32 | 32 |
33 // Registers the JNI bindings. | 33 // Registers the JNI bindings. |
34 static bool Register(JNIEnv* env); | 34 static bool Register(JNIEnv* env); |
35 | 35 |
36 // Called by JNI | 36 // Called by JNI |
37 base::android::ScopedJavaLocalRef<jobject> GetProfileAndroid(JNIEnv* env, | 37 base::android::ScopedJavaLocalRef<jobject> GetProfileAndroid(JNIEnv* env, |
38 jobject obj); | 38 jobject obj); |
39 void TabAddedToModel(JNIEnv* env, jobject obj, jobject jtab); | 39 void TabAddedToModel(JNIEnv* env, jobject obj, jobject jtab); |
40 | 40 |
41 // TabModel:: | 41 // TabModel:: |
42 virtual int GetTabCount() const override; | 42 int GetTabCount() const override; |
43 virtual int GetActiveIndex() const override; | 43 int GetActiveIndex() const override; |
44 virtual content::WebContents* GetWebContentsAt(int index) const override; | 44 content::WebContents* GetWebContentsAt(int index) const override; |
45 virtual TabAndroid* GetTabAt(int index) const override; | 45 TabAndroid* GetTabAt(int index) const override; |
46 | 46 |
47 virtual void SetActiveIndex(int index) override; | 47 void SetActiveIndex(int index) override; |
48 virtual void CloseTabAt(int index) override; | 48 void CloseTabAt(int index) override; |
49 | 49 |
50 virtual void CreateTab(content::WebContents* web_contents, | 50 void CreateTab(content::WebContents* web_contents, |
51 int parent_tab_id) override; | 51 int parent_tab_id) override; |
52 | 52 |
53 virtual content::WebContents* CreateNewTabForDevTools( | 53 content::WebContents* CreateNewTabForDevTools(const GURL& url) override; |
54 const GURL& url) override; | |
55 | 54 |
56 // Return true if we are currently restoring sessions asynchronously. | 55 // Return true if we are currently restoring sessions asynchronously. |
57 virtual bool IsSessionRestoreInProgress() const override; | 56 bool IsSessionRestoreInProgress() const override; |
58 | 57 |
59 // Instructs the TabModel to broadcast a notification that all tabs are now | 58 // Instructs the TabModel to broadcast a notification that all tabs are now |
60 // loaded from storage. | 59 // loaded from storage. |
61 void BroadcastSessionRestoreComplete(JNIEnv* env, jobject obj); | 60 void BroadcastSessionRestoreComplete(JNIEnv* env, jobject obj); |
62 | 61 |
63 protected: | 62 protected: |
64 JavaObjectWeakGlobalRef java_object_; | 63 JavaObjectWeakGlobalRef java_object_; |
65 | 64 |
66 private: | 65 private: |
67 DISALLOW_COPY_AND_ASSIGN(TabModelJniBridge); | 66 DISALLOW_COPY_AND_ASSIGN(TabModelJniBridge); |
68 }; | 67 }; |
69 | 68 |
70 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_ | 69 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_ |
OLD | NEW |