Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / android / foreign_session_helper.cc
index 57f3405..2f3d0ac 100644 (file)
@@ -20,6 +20,8 @@
 #include "chrome/browser/ui/android/tab_model/tab_model_list.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/url_constants.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_source.h"
 #include "content/public/browser/web_contents.h"
 #include "jni/ForeignSessionHelper_jni.h"
@@ -40,7 +42,7 @@ OpenTabsUIDelegate* GetOpenTabsUIDelegate(Profile* profile) {
       GetForProfile(profile);
 
   // Only return the delegate if it exists and it is done syncing sessions.
-  if (!service || !service->ShouldPushChanges())
+  if (!service || !service->SyncActive())
     return NULL;
 
   return service->GetOpenTabsUIDelegate();
@@ -164,6 +166,14 @@ jboolean ForeignSessionHelper::IsTabSyncEnabled(JNIEnv* env, jobject obj) {
   return service && service->GetActiveDataTypes().Has(syncer::PROXY_TABS);
 }
 
+void ForeignSessionHelper::TriggerSessionSync(JNIEnv* env, jobject obj) {
+  const syncer::ModelTypeSet types(syncer::SESSIONS);
+  content::NotificationService::current()->Notify(
+      chrome::NOTIFICATION_SYNC_REFRESH_LOCAL,
+      content::Source<Profile>(profile_),
+      content::Details<const syncer::ModelTypeSet>(&types));
+}
+
 void ForeignSessionHelper::SetOnForeignSessionCallback(JNIEnv* env,
                                                        jobject obj,
                                                        jobject callback) {