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 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import org.chromium.base.CalledByNative; | 7 import org.chromium.base.CalledByNative; |
8 import org.chromium.chrome.browser.profiles.Profile; | 8 import org.chromium.chrome.browser.profiles.Profile; |
9 | 9 |
10 import java.util.ArrayList; | 10 import java.util.ArrayList; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 * Opens the given foreign tab in a new tab. | 180 * Opens the given foreign tab in a new tab. |
181 * @param session Session that the target tab belongs to. | 181 * @param session Session that the target tab belongs to. |
182 * @param tab Target tab to open. | 182 * @param tab Target tab to open. |
183 * @return {@code True} iff the tab is successfully opened. | 183 * @return {@code True} iff the tab is successfully opened. |
184 */ | 184 */ |
185 public boolean openForeignSessionTab(ForeignSession session, ForeignSessionT
ab tab) { | 185 public boolean openForeignSessionTab(ForeignSession session, ForeignSessionT
ab tab) { |
186 return nativeOpenForeignSessionTab(mNativeForeignSessionHelper, session.
tag, tab.id); | 186 return nativeOpenForeignSessionTab(mNativeForeignSessionHelper, session.
tag, tab.id); |
187 } | 187 } |
188 | 188 |
189 /** | 189 /** |
190 * Set the given session collapsed or uncollapsed in preferences. | |
191 * @param session Session to set collapsed or uncollapsed. | |
192 * @param isCollapsed {@code True} iff we want the session to be collapsed. | |
193 */ | |
194 public void setForeignSessionCollapsed(ForeignSession session, boolean isCol
lapsed) { | |
195 nativeSetForeignSessionCollapsed(mNativeForeignSessionHelper, session.ta
g, isCollapsed); | |
196 } | |
197 | |
198 /** | |
199 * Get the given session collapsed or uncollapsed state in preferences. | |
200 * @param session Session to fetch collapsed state. | |
201 * @return {@code True} if the session is collapsed, false if expand
ed. | |
202 */ | |
203 public boolean getForeignSessionCollapsed(ForeignSession session) { | |
204 return nativeGetForeignSessionCollapsed(mNativeForeignSessionHelper, ses
sion.tag); | |
205 } | |
206 | |
207 /** | |
208 * Remove Foreign session to display. Note that it will be reappear on the n
ext sync. | 190 * Remove Foreign session to display. Note that it will be reappear on the n
ext sync. |
209 * | 191 * |
210 * This is mainly for when user wants to delete very old session that won't
be used or syned in | 192 * This is mainly for when user wants to delete very old session that won't
be used or syned in |
211 * the future. | 193 * the future. |
212 * @param session Session to be deleted. | 194 * @param session Session to be deleted. |
213 */ | 195 */ |
214 public void deleteForeignSession(ForeignSession session) { | 196 public void deleteForeignSession(ForeignSession session) { |
215 nativeDeleteForeignSession(mNativeForeignSessionHelper, session.tag); | 197 nativeDeleteForeignSession(mNativeForeignSessionHelper, session.tag); |
216 } | 198 } |
217 | 199 |
218 private static native int nativeInit(Profile profile); | 200 private static native int nativeInit(Profile profile); |
219 private static native void nativeDestroy(int nativeForeignSessionHelper); | 201 private static native void nativeDestroy(int nativeForeignSessionHelper); |
220 private static native boolean nativeIsTabSyncEnabled(int nativeForeignSessio
nHelper); | 202 private static native boolean nativeIsTabSyncEnabled(int nativeForeignSessio
nHelper); |
221 private static native void nativeSetOnForeignSessionCallback( | 203 private static native void nativeSetOnForeignSessionCallback( |
222 int nativeForeignSessionHelper, ForeignSessionCallback callback); | 204 int nativeForeignSessionHelper, ForeignSessionCallback callback); |
223 private static native boolean nativeGetForeignSessions(int nativeForeignSess
ionHelper, | 205 private static native boolean nativeGetForeignSessions(int nativeForeignSess
ionHelper, |
224 List<ForeignSession> resultSessions); | 206 List<ForeignSession> resultSessions); |
225 private static native boolean nativeOpenForeignSessionTab( | 207 private static native boolean nativeOpenForeignSessionTab( |
226 int nativeForeignSessionHelper, String sessionTag, int tabId); | 208 int nativeForeignSessionHelper, String sessionTag, int tabId); |
227 private static native void nativeSetForeignSessionCollapsed( | |
228 int nativeForeignSessionHelper, String sessionTag, boolean isCollaps
ed); | |
229 private static native boolean nativeGetForeignSessionCollapsed( | |
230 int nativeForeignSessionHelper, String sessionTag); | |
231 private static native void nativeDeleteForeignSession( | 209 private static native void nativeDeleteForeignSession( |
232 int nativeForeignSessionHelper, String sessionTag); | 210 int nativeForeignSessionHelper, String sessionTag); |
233 } | 211 } |
OLD | NEW |