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

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: Blarg. 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 70%
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 b1972936f5657fe10af46b99ec2d2baa9efad42a..77a614d2b8456741c7d563980f2aa733859d8c94 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,20 +21,24 @@ 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;
@@ -45,6 +49,7 @@ class TabModelBase : public TabModel {
virtual void CreateTab(content::WebContents* web_contents,
int parent_tab_id) override;
+
virtual content::WebContents* CreateNewTabForDevTools(
const GURL& url) override;
@@ -55,13 +60,11 @@ class TabModelBase : public TabModel {
// loaded from storage.
void BroadcastSessionRestoreComplete(JNIEnv* env, jobject obj);
- private:
- virtual ~TabModelBase();
-
+ protected:
JavaObjectWeakGlobalRef java_object_;
-};
-// Register the Tab's native methods through jni.
-bool RegisterTabModelBase(JNIEnv* env);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TabModelJniBridge);
+};
-#endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_BASE_H_
+#endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_
« no previous file with comments | « chrome/browser/ui/android/tab_model/tab_model_base.cc ('k') | chrome/browser/ui/android/tab_model/tab_model_jni_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698