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

Side by Side Diff: chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h

Issue 1481553002: jni: Pass method parameters as JavaParamRef in chrome/browser/ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
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
11 #include "base/android/jni_weak_ref.h" 11 #include "base/android/jni_weak_ref.h"
12 #include "base/android/scoped_java_ref.h" 12 #include "base/android/scoped_java_ref.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "chrome/browser/ui/android/tab_model/tab_model.h" 15 #include "chrome/browser/ui/android/tab_model/tab_model.h"
16 16
17 class Profile; 17 class Profile;
18 class TabAndroid; 18 class TabAndroid;
19 19
20 namespace content { 20 namespace content {
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, const base::android::JavaParamRef<jobject>& obj);
31 ~TabModelJniBridge() override; 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(
38 jobject obj); 38 JNIEnv* env,
39 void TabAddedToModel(JNIEnv* env, jobject obj, jobject jtab); 39 const base::android::JavaParamRef<jobject>& obj);
40 void TabAddedToModel(JNIEnv* env,
41 const base::android::JavaParamRef<jobject>& obj,
42 const base::android::JavaParamRef<jobject>& jtab);
40 43
41 // TabModel:: 44 // TabModel::
42 int GetTabCount() const override; 45 int GetTabCount() const override;
43 int GetActiveIndex() const override; 46 int GetActiveIndex() const override;
44 content::WebContents* GetWebContentsAt(int index) const override; 47 content::WebContents* GetWebContentsAt(int index) const override;
45 TabAndroid* GetTabAt(int index) const override; 48 TabAndroid* GetTabAt(int index) const override;
46 49
47 void SetActiveIndex(int index) override; 50 void SetActiveIndex(int index) override;
48 void CloseTabAt(int index) override; 51 void CloseTabAt(int index) override;
49 52
50 void CreateTab(content::WebContents* web_contents, 53 void CreateTab(content::WebContents* web_contents,
51 int parent_tab_id) override; 54 int parent_tab_id) override;
52 55
53 content::WebContents* CreateNewTabForDevTools(const GURL& url) override; 56 content::WebContents* CreateNewTabForDevTools(const GURL& url) override;
54 57
55 // Return true if we are currently restoring sessions asynchronously. 58 // Return true if we are currently restoring sessions asynchronously.
56 bool IsSessionRestoreInProgress() const override; 59 bool IsSessionRestoreInProgress() const override;
57 60
58 // Instructs the TabModel to broadcast a notification that all tabs are now 61 // Instructs the TabModel to broadcast a notification that all tabs are now
59 // loaded from storage. 62 // loaded from storage.
60 void BroadcastSessionRestoreComplete(JNIEnv* env, jobject obj); 63 void BroadcastSessionRestoreComplete(
64 JNIEnv* env,
65 const base::android::JavaParamRef<jobject>& obj);
61 66
62 protected: 67 protected:
63 JavaObjectWeakGlobalRef java_object_; 68 JavaObjectWeakGlobalRef java_object_;
64 69
65 private: 70 private:
66 DISALLOW_COPY_AND_ASSIGN(TabModelJniBridge); 71 DISALLOW_COPY_AND_ASSIGN(TabModelJniBridge);
67 }; 72 };
68 73
69 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_ 74 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698