| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 env, j_session.obj(), | 135 env, j_session.obj(), |
| 136 window.timestamp.ToJavaTime(), | 136 window.timestamp.ToJavaTime(), |
| 137 window.window_id.id())); | 137 window.window_id.id())); |
| 138 | 138 |
| 139 CopyWindowToJava(env, window, last_pushed_window); | 139 CopyWindowToJava(env, window, last_pushed_window); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace | 143 } // namespace |
| 144 | 144 |
| 145 static jlong Init(JNIEnv* env, jclass clazz, jobject profile) { | 145 static jlong Init(JNIEnv* env, |
| 146 const JavaParamRef<jclass>& clazz, |
| 147 const JavaParamRef<jobject>& profile) { |
| 146 ForeignSessionHelper* foreign_session_helper = new ForeignSessionHelper( | 148 ForeignSessionHelper* foreign_session_helper = new ForeignSessionHelper( |
| 147 ProfileAndroid::FromProfileAndroid(profile)); | 149 ProfileAndroid::FromProfileAndroid(profile)); |
| 148 return reinterpret_cast<intptr_t>(foreign_session_helper); | 150 return reinterpret_cast<intptr_t>(foreign_session_helper); |
| 149 } | 151 } |
| 150 | 152 |
| 151 ForeignSessionHelper::ForeignSessionHelper(Profile* profile) | 153 ForeignSessionHelper::ForeignSessionHelper(Profile* profile) |
| 152 : profile_(profile) { | 154 : profile_(profile) { |
| 153 ProfileSyncService* service = ProfileSyncServiceFactory::GetInstance()-> | 155 ProfileSyncService* service = ProfileSyncServiceFactory::GetInstance()-> |
| 154 GetForProfile(profile); | 156 GetForProfile(profile); |
| 155 registrar_.Add(this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, | 157 registrar_.Add(this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 jstring session_tag) { | 326 jstring session_tag) { |
| 325 OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(profile_); | 327 OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(profile_); |
| 326 if (open_tabs) | 328 if (open_tabs) |
| 327 open_tabs->DeleteForeignSession(ConvertJavaStringToUTF8(env, session_tag)); | 329 open_tabs->DeleteForeignSession(ConvertJavaStringToUTF8(env, session_tag)); |
| 328 } | 330 } |
| 329 | 331 |
| 330 // static | 332 // static |
| 331 bool ForeignSessionHelper::RegisterForeignSessionHelper(JNIEnv* env) { | 333 bool ForeignSessionHelper::RegisterForeignSessionHelper(JNIEnv* env) { |
| 332 return RegisterNativesImpl(env); | 334 return RegisterNativesImpl(env); |
| 333 } | 335 } |
| OLD | NEW |