| OLD | NEW |
| 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 #include "chrome/browser/android/foreign_session_helper.h" | 5 #include "chrome/browser/android/foreign_session_helper.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 | 8 |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 env, j_session.obj(), | 130 env, j_session.obj(), |
| 131 window.timestamp.ToJavaTime(), | 131 window.timestamp.ToJavaTime(), |
| 132 window.window_id.id())); | 132 window.window_id.id())); |
| 133 | 133 |
| 134 CopyTabsToJava(env, window, last_pushed_window); | 134 CopyTabsToJava(env, window, last_pushed_window); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace | 138 } // namespace |
| 139 | 139 |
| 140 static jint Init(JNIEnv* env, jclass clazz, jobject profile) { | 140 static jlong Init(JNIEnv* env, jclass clazz, jobject profile) { |
| 141 ForeignSessionHelper* foreign_session_helper = new ForeignSessionHelper( | 141 ForeignSessionHelper* foreign_session_helper = new ForeignSessionHelper( |
| 142 ProfileAndroid::FromProfileAndroid(profile)); | 142 ProfileAndroid::FromProfileAndroid(profile)); |
| 143 return reinterpret_cast<jint>(foreign_session_helper); | 143 return reinterpret_cast<intptr_t>(foreign_session_helper); |
| 144 } | 144 } |
| 145 | 145 |
| 146 ForeignSessionHelper::ForeignSessionHelper(Profile* profile) | 146 ForeignSessionHelper::ForeignSessionHelper(Profile* profile) |
| 147 : profile_(profile) { | 147 : profile_(profile) { |
| 148 ProfileSyncService* service = ProfileSyncServiceFactory::GetInstance()-> | 148 ProfileSyncService* service = ProfileSyncServiceFactory::GetInstance()-> |
| 149 GetForProfile(profile); | 149 GetForProfile(profile); |
| 150 registrar_.Add(this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, | 150 registrar_.Add(this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, |
| 151 content::Source<ProfileSyncService>(service)); | 151 content::Source<ProfileSyncService>(service)); |
| 152 registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, | 152 registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, |
| 153 content::Source<Profile>(profile)); | 153 content::Source<Profile>(profile)); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 jstring session_tag) { | 338 jstring session_tag) { |
| 339 SessionModelAssociator* associator = GetSessionModelAssociator(profile_); | 339 SessionModelAssociator* associator = GetSessionModelAssociator(profile_); |
| 340 if (associator) | 340 if (associator) |
| 341 associator->DeleteForeignSession(ConvertJavaStringToUTF8(env, session_tag)); | 341 associator->DeleteForeignSession(ConvertJavaStringToUTF8(env, session_tag)); |
| 342 } | 342 } |
| 343 | 343 |
| 344 // static | 344 // static |
| 345 bool ForeignSessionHelper::RegisterForeignSessionHelper(JNIEnv* env) { | 345 bool ForeignSessionHelper::RegisterForeignSessionHelper(JNIEnv* env) { |
| 346 return RegisterNativesImpl(env); | 346 return RegisterNativesImpl(env); |
| 347 } | 347 } |
| OLD | NEW |