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

Side by Side Diff: chrome/browser/android/recently_closed_tabs_bridge.h

Issue 2610143002: Add RecentTabsPageTest (Closed)
Patch Set: Undo the prefs changes. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_ANDROID_RECENTLY_CLOSED_TABS_BRIDGE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_RECENTLY_CLOSED_TABS_BRIDGE_H_
6 #define CHROME_BROWSER_ANDROID_RECENTLY_CLOSED_TABS_BRIDGE_H_ 6 #define CHROME_BROWSER_ANDROID_RECENTLY_CLOSED_TABS_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/sessions/core/tab_restore_service_observer.h" 13 #include "components/sessions/core/tab_restore_service_observer.h"
14 14
15 class Profile; 15 class Profile;
16 16
17 // Provides the list of recently closed tabs to Java. 17 // Provides the list of recently closed tabs to Java.
18 class RecentlyClosedTabsBridge : public sessions::TabRestoreServiceObserver { 18 class RecentlyClosedTabsBridge : public sessions::TabRestoreServiceObserver {
19 public: 19 public:
20 explicit RecentlyClosedTabsBridge(Profile* profile); 20 RecentlyClosedTabsBridge(const base::android::JavaParamRef<jobject>& bridge,
21 Profile* profile);
21 22
22 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 23 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
23 void SetRecentlyClosedCallback(
24 JNIEnv* env,
25 const base::android::JavaParamRef<jobject>& obj,
26 const base::android::JavaParamRef<jobject>& jcallback);
27 jboolean GetRecentlyClosedTabs( 24 jboolean GetRecentlyClosedTabs(
28 JNIEnv* env, 25 JNIEnv* env,
29 const base::android::JavaParamRef<jobject>& obj, 26 const base::android::JavaParamRef<jobject>& obj,
30 const base::android::JavaParamRef<jobject>& jtabs, 27 const base::android::JavaParamRef<jobject>& jtabs,
31 jint max_tab_count); 28 jint max_tab_count);
32 jboolean OpenRecentlyClosedTab( 29 jboolean OpenRecentlyClosedTab(
33 JNIEnv* env, 30 JNIEnv* env,
34 const base::android::JavaParamRef<jobject>& obj, 31 const base::android::JavaParamRef<jobject>& obj,
35 const base::android::JavaParamRef<jobject>& jtab, 32 const base::android::JavaParamRef<jobject>& jtab,
36 jint tab_id, 33 jint tab_id,
37 jint j_disposition); 34 jint j_disposition);
38 jboolean OpenMostRecentlyClosedTab( 35 jboolean OpenMostRecentlyClosedTab(
39 JNIEnv* env, 36 JNIEnv* env,
40 const base::android::JavaParamRef<jobject>& obj); 37 const base::android::JavaParamRef<jobject>& obj);
41 void ClearRecentlyClosedTabs(JNIEnv* env, 38 void ClearRecentlyClosedTabs(JNIEnv* env,
42 const base::android::JavaParamRef<jobject>& obj); 39 const base::android::JavaParamRef<jobject>& obj);
43 40
44 // Observer callback for TabRestoreServiceObserver. Notifies the registered 41 // Observer callback for TabRestoreServiceObserver. Notifies the Java bridge
45 // callback that the recently closed tabs list has changed. 42 // that the recently closed tabs list has changed.
46 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override; 43 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override;
47 44
48 // Observer callback when our associated TabRestoreService is destroyed. 45 // Observer callback when our associated TabRestoreService is destroyed.
49 void TabRestoreServiceDestroyed( 46 void TabRestoreServiceDestroyed(
50 sessions::TabRestoreService* service) override; 47 sessions::TabRestoreService* service) override;
51 48
52 // Registers JNI methods. 49 // Registers JNI methods.
53 static bool Register(JNIEnv* env); 50 static bool Register(JNIEnv* env);
54 51
55 private: 52 private:
56 ~RecentlyClosedTabsBridge() override; 53 ~RecentlyClosedTabsBridge() override;
57 54
58 // Construct and initialize tab_restore_service_ if it's NULL. 55 // Construct and initialize tab_restore_service_ if it's NULL.
59 // tab_restore_service_ may still be NULL, however, in incognito mode. 56 // tab_restore_service_ may still be NULL, however, in incognito mode.
60 void EnsureTabRestoreService(); 57 void EnsureTabRestoreService();
61 58
62 // The callback to be notified when the list of recently closed tabs changes. 59 // The Java RecentlyClosedBridge.
63 base::android::ScopedJavaGlobalRef<jobject> callback_; 60 base::android::ScopedJavaGlobalRef<jobject> bridge_;
64 61
65 // The profile whose recently closed tabs are being monitored. 62 // The profile whose recently closed tabs are being monitored.
66 Profile* profile_; 63 Profile* profile_;
67 64
68 // TabRestoreService that we are observing. 65 // TabRestoreService that we are observing.
69 sessions::TabRestoreService* tab_restore_service_; 66 sessions::TabRestoreService* tab_restore_service_;
70 67
71 DISALLOW_COPY_AND_ASSIGN(RecentlyClosedTabsBridge); 68 DISALLOW_COPY_AND_ASSIGN(RecentlyClosedTabsBridge);
72 }; 69 };
73 70
74 #endif // CHROME_BROWSER_ANDROID_RECENTLY_CLOSED_TABS_BRIDGE_H_ 71 #endif // CHROME_BROWSER_ANDROID_RECENTLY_CLOSED_TABS_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698