| 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/recently_closed_tabs_bridge.h" | 5 #include "chrome/browser/android/recently_closed_tabs_bridge.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "chrome/browser/android/tab_android.h" | 8 #include "chrome/browser/android/tab_android.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/profiles/profile_android.h" | 10 #include "chrome/browser/profiles/profile_android.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 if (!web_contents) | 106 if (!web_contents) |
| 107 return false; | 107 return false; |
| 108 | 108 |
| 109 // RestoreForeignSessionTab needs a SessionTab. | 109 // RestoreForeignSessionTab needs a SessionTab. |
| 110 SessionTab session_tab; | 110 SessionTab session_tab; |
| 111 session_tab.current_navigation_index = tab_entry->current_navigation_index; | 111 session_tab.current_navigation_index = tab_entry->current_navigation_index; |
| 112 session_tab.navigations = tab_entry->navigations; | 112 session_tab.navigations = tab_entry->navigations; |
| 113 | 113 |
| 114 SessionRestore::RestoreForeignSessionTab(web_contents, | 114 SessionRestore::RestoreForeignSessionTab(web_contents, |
| 115 session_tab, | 115 session_tab, |
| 116 NEW_FOREGROUND_TAB); | 116 CURRENT_TAB); |
| 117 return true; | 117 return true; |
| 118 } | 118 } |
| 119 | 119 |
| 120 void RecentlyClosedTabsBridge::ClearRecentlyClosedTabs(JNIEnv* env, | 120 void RecentlyClosedTabsBridge::ClearRecentlyClosedTabs(JNIEnv* env, |
| 121 jobject obj) { | 121 jobject obj) { |
| 122 EnsureTabRestoreService(); | 122 EnsureTabRestoreService(); |
| 123 if (tab_restore_service_) | 123 if (tab_restore_service_) |
| 124 tab_restore_service_->ClearEntries(); | 124 tab_restore_service_->ClearEntries(); |
| 125 } | 125 } |
| 126 | 126 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 156 static jint Init(JNIEnv* env, jobject obj, jobject jprofile) { | 156 static jint Init(JNIEnv* env, jobject obj, jobject jprofile) { |
| 157 RecentlyClosedTabsBridge* bridge = new RecentlyClosedTabsBridge( | 157 RecentlyClosedTabsBridge* bridge = new RecentlyClosedTabsBridge( |
| 158 ProfileAndroid::FromProfileAndroid(jprofile)); | 158 ProfileAndroid::FromProfileAndroid(jprofile)); |
| 159 return reinterpret_cast<jint>(bridge); | 159 return reinterpret_cast<jint>(bridge); |
| 160 } | 160 } |
| 161 | 161 |
| 162 // static | 162 // static |
| 163 bool RecentlyClosedTabsBridge::Register(JNIEnv* env) { | 163 bool RecentlyClosedTabsBridge::Register(JNIEnv* env) { |
| 164 return RegisterNativesImpl(env); | 164 return RegisterNativesImpl(env); |
| 165 } | 165 } |
| OLD | NEW |