Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(961)

Unified Diff: chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h

Issue 583373002: Break apart the TabModelBase's JNI calls into its own class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Breaking apart the bridge Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h
diff --git a/chrome/browser/ui/android/tab_model/tab_model_base.h b/chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h
similarity index 63%
copy from chrome/browser/ui/android/tab_model/tab_model_base.h
copy to chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h
index 60b4c1e935d6284288a8ab215c346569923b83fc..7c948ea1c4a2e962768b9af17c00402db723fbc3 100644
--- a/chrome/browser/ui/android/tab_model/tab_model_base.h
+++ b/chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_BASE_H_
-#define CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_BASE_H_
+#ifndef CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_
+#define CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_
#include <jni.h>
#include <vector>
@@ -21,32 +21,32 @@ namespace content {
class WebContents;
}
-// Native representation of TabModelBase which provides access to information
-// about a tabstrip to native code and could potentially be used in place of
-// Browser for some functionality in Clank.
-class TabModelBase : public TabModel {
+// Bridges calls between the C++ and the Java TabModels. Functions in this
+// class should do little more than make calls out to the Java TabModel, which
+// is what actually stores Tabs.
+class TabModelJniBridge : public TabModel {
public:
- TabModelBase(JNIEnv* env, jobject obj, Profile* profile);
+ TabModelJniBridge(JNIEnv* env, jobject obj, bool is_incognito);
void Destroy(JNIEnv* env, jobject obj);
+ virtual ~TabModelJniBridge();
+
+ // Registers the JNI bindings.
+ static bool Register(JNIEnv* env);
// Called by JNI
base::android::ScopedJavaLocalRef<jobject> GetProfileAndroid(JNIEnv* env,
jobject obj);
void TabAddedToModel(JNIEnv* env, jobject obj, jobject jtab);
- // TabModel:
+ // TabModel::
virtual int GetTabCount() const OVERRIDE;
virtual int GetActiveIndex() const OVERRIDE;
virtual content::WebContents* GetWebContentsAt(int index) const OVERRIDE;
- virtual TabAndroid* GetTabAt(int index) const OVERRIDE;
virtual void SetActiveIndex(int index) OVERRIDE;
- virtual void CloseTabAt(int index) OVERRIDE;
virtual void CreateTab(content::WebContents* web_contents,
int parent_tab_id) OVERRIDE;
- virtual content::WebContents* CreateNewTabForDevTools(
- const GURL& url) OVERRIDE;
// Return true if we are currently restoring sessions asynchronously.
virtual bool IsSessionRestoreInProgress() const OVERRIDE;
@@ -55,13 +55,8 @@ class TabModelBase : public TabModel {
// loaded from storage.
void BroadcastSessionRestoreComplete(JNIEnv* env, jobject obj);
- private:
- virtual ~TabModelBase();
-
+ protected:
JavaObjectWeakGlobalRef java_object_;
};
David Trainor- moved to gerrit 2014/10/09 20:43:42 Disallow copy and assign?
gone 2014/10/10 22:39:19 Done.
-// Register the Tab's native methods through jni.
-bool RegisterTabModelBase(JNIEnv* env);
-
-#endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_BASE_H_
+#endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_

Powered by Google App Engine
This is Rietveld 408576698