- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / android / foreign_session_helper.h
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_ANDROID_FOREIGN_SESSION_HELPER_H_
6 #define CHROME_BROWSER_ANDROID_FOREIGN_SESSION_HELPER_H_
7
8 #include <jni.h>
9
10 #include "base/android/scoped_java_ref.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14
15 using base::android::ScopedJavaLocalRef;
16
17 struct SessionWindow;
18
19 namespace browser_sync {
20 class SessionModelAssociator;
21 struct SyncedSession;
22 }  // namespace browser_sync
23
24 class ForeignSessionHelper : public content::NotificationObserver {
25  public:
26   explicit ForeignSessionHelper(Profile* profile);
27   void Destroy(JNIEnv* env, jobject obj);
28   jboolean IsTabSyncEnabled(JNIEnv* env, jobject obj);
29   void SetOnForeignSessionCallback(JNIEnv* env, jobject obj, jobject callback);
30   jboolean GetForeignSessions(JNIEnv* env, jobject obj, jobject result);
31   jboolean OpenForeignSessionTab(JNIEnv* env,
32                                  jobject obj,
33                                  jstring session_tag,
34                                  jint tab_id);
35   void SetForeignSessionCollapsed(JNIEnv* env,
36                                   jobject obj,
37                                   jstring session_tag,
38                                   jboolean is_collapsed);
39   jboolean GetForeignSessionCollapsed(JNIEnv* env,
40                                       jobject obj,
41                                       jstring session_tag);
42   void DeleteForeignSession(JNIEnv* env, jobject obj, jstring session_tag);
43
44   // NotificationObserver implemenation
45   virtual void Observe(int type,
46                        const content::NotificationSource& source,
47                        const content::NotificationDetails& details) OVERRIDE;
48
49   static bool RegisterForeignSessionHelper(JNIEnv* env);
50
51  private:
52   virtual ~ForeignSessionHelper();
53
54   Profile* profile_;  // weak
55   base::android::ScopedJavaGlobalRef<jobject> callback_;
56   content::NotificationRegistrar registrar_;
57
58   DISALLOW_COPY_AND_ASSIGN(ForeignSessionHelper);
59 };
60
61 #endif  // CHROME_BROWSER_ANDROID_FOREIGN_SESSION_HELPER_H_