| 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 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "chrome/browser/android/tab_android.h" | 11 #include "chrome/browser/android/tab_android.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/profiles/profile_android.h" | 13 #include "chrome/browser/profiles/profile_android.h" |
| 14 #include "chrome/browser/sessions/session_restore.h" | 14 #include "chrome/browser/sessions/session_restore.h" |
| 15 #include "chrome/browser/sync/profile_sync_service_factory.h" | 15 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 16 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 16 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
| 17 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | 17 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
| 18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 20 #include "components/browser_sync/browser/profile_sync_service.h" | 20 #include "components/browser_sync/browser/profile_sync_service.h" |
| 21 #include "components/prefs/pref_service.h" | 21 #include "components/prefs/pref_service.h" |
| 22 #include "components/prefs/scoped_user_pref_update.h" | 22 #include "components/prefs/scoped_user_pref_update.h" |
| 23 #include "components/sync_sessions/open_tabs_ui_delegate.h" | 23 #include "components/sync_sessions/open_tabs_ui_delegate.h" |
| 24 #include "content/public/browser/notification_details.h" | 24 #include "content/public/browser/notification_details.h" |
| 25 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
| 26 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "jni/ForeignSessionHelper_jni.h" | 28 #include "jni/ForeignSessionHelper_jni.h" |
| 29 | 29 |
| 30 using base::android::JavaParamRef; |
| 30 using base::android::ScopedJavaGlobalRef; | 31 using base::android::ScopedJavaGlobalRef; |
| 31 using base::android::ScopedJavaLocalRef; | 32 using base::android::ScopedJavaLocalRef; |
| 32 using base::android::AttachCurrentThread; | 33 using base::android::AttachCurrentThread; |
| 33 using base::android::ConvertUTF16ToJavaString; | 34 using base::android::ConvertUTF16ToJavaString; |
| 34 using base::android::ConvertUTF8ToJavaString; | 35 using base::android::ConvertUTF8ToJavaString; |
| 35 using base::android::ConvertJavaStringToUTF8; | 36 using base::android::ConvertJavaStringToUTF8; |
| 36 using sync_driver::OpenTabsUIDelegate; | 37 using sync_driver::OpenTabsUIDelegate; |
| 37 using sync_driver::SyncedSession; | 38 using sync_driver::SyncedSession; |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 const JavaParamRef<jstring>& session_tag) { | 331 const JavaParamRef<jstring>& session_tag) { |
| 331 OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(profile_); | 332 OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(profile_); |
| 332 if (open_tabs) | 333 if (open_tabs) |
| 333 open_tabs->DeleteForeignSession(ConvertJavaStringToUTF8(env, session_tag)); | 334 open_tabs->DeleteForeignSession(ConvertJavaStringToUTF8(env, session_tag)); |
| 334 } | 335 } |
| 335 | 336 |
| 336 // static | 337 // static |
| 337 bool ForeignSessionHelper::RegisterForeignSessionHelper(JNIEnv* env) { | 338 bool ForeignSessionHelper::RegisterForeignSessionHelper(JNIEnv* env) { |
| 338 return RegisterNativesImpl(env); | 339 return RegisterNativesImpl(env); |
| 339 } | 340 } |
| OLD | NEW |