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.TabBase; | |
8 import org.chromium.chrome.browser.profiles.Profile; | 9 import org.chromium.chrome.browser.profiles.Profile; |
9 | 10 |
10 import java.util.ArrayList; | 11 import java.util.ArrayList; |
11 import java.util.Collections; | 12 import java.util.Collections; |
12 import java.util.Comparator; | 13 import java.util.Comparator; |
13 import java.util.List; | 14 import java.util.List; |
14 | 15 |
15 /** | 16 /** |
16 * This class exposes to Java information about sessions, windows, and tabs on t he user's synced | 17 * This class exposes to Java information about sessions, windows, and tabs on t he user's synced |
17 * devices. | 18 * devices. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 } | 171 } |
171 }); | 172 }); |
172 } else { | 173 } else { |
173 result = null; | 174 result = null; |
174 } | 175 } |
175 | 176 |
176 return result; | 177 return result; |
177 } | 178 } |
178 | 179 |
179 /** | 180 /** |
181 * TODO (apiccion): Remvoe this method once downstream CL Lands. | |
182 * See: https://code.google.com/p/chromium/issues/detail?id=257102 | |
180 * Opens the given foreign tab in a new tab. | 183 * Opens the given foreign tab in a new tab. |
181 * @param session Session that the target tab belongs to. | 184 * @param session Session that the target tab belongs to. |
182 * @param tab Target tab to open. | 185 * @param tab Target tab to open. |
183 * @return {@code True} iff the tab is successfully opened. | 186 * @return {@code True} iff the tab is successfully opened. |
184 */ | 187 */ |
185 public boolean openForeignSessionTab(ForeignSession session, ForeignSessionT ab tab) { | 188 public boolean openForeignSessionTab(ForeignSession session, ForeignSessionT ab tab) { |
186 return nativeOpenForeignSessionTab(mNativeForeignSessionHelper, session. tag, tab.id); | 189 return nativeOpenForeignSessionTabOld(mNativeForeignSessionHelper, sessi on.tag, tab.id); |
187 } | 190 } |
188 | 191 |
189 /** | 192 /** |
193 * Opens the given foreign tab in a new tab. | |
194 * @param tab Tab to load the session into. | |
195 * @param session Session that the target tab belongs to. | |
196 * @param foreignTab Target tab to open. | |
197 * @return {@code True} iff the tab is successfully opened. | |
198 */ | |
199 public boolean openForeignSessionTab(TabBase tab, ForeignSession session, | |
200 ForeignSessionTab foreignTab) { | |
newt (away)
2013/11/01 23:41:32
could you add windowDisposition here as another ar
apiccion
2013/11/02 01:01:14
Added windowDisposition. Cannot remove *Old() call
| |
201 return nativeOpenForeignSessionTab(mNativeForeignSessionHelper, tab, ses sion.tag, | |
202 foreignTab.id); | |
203 } | |
204 | |
205 /** | |
190 * Set the given session collapsed or uncollapsed in preferences. | 206 * Set the given session collapsed or uncollapsed in preferences. |
191 * @param session Session to set collapsed or uncollapsed. | 207 * @param session Session to set collapsed or uncollapsed. |
192 * @param isCollapsed {@code True} iff we want the session to be collapsed. | 208 * @param isCollapsed {@code True} iff we want the session to be collapsed. |
193 */ | 209 */ |
194 public void setForeignSessionCollapsed(ForeignSession session, boolean isCol lapsed) { | 210 public void setForeignSessionCollapsed(ForeignSession session, boolean isCol lapsed) { |
195 nativeSetForeignSessionCollapsed(mNativeForeignSessionHelper, session.ta g, isCollapsed); | 211 nativeSetForeignSessionCollapsed(mNativeForeignSessionHelper, session.ta g, isCollapsed); |
196 } | 212 } |
197 | 213 |
198 /** | 214 /** |
199 * Get the given session collapsed or uncollapsed state in preferences. | 215 * Get the given session collapsed or uncollapsed state in preferences. |
(...skipping 15 matching lines...) Expand all Loading... | |
215 nativeDeleteForeignSession(mNativeForeignSessionHelper, session.tag); | 231 nativeDeleteForeignSession(mNativeForeignSessionHelper, session.tag); |
216 } | 232 } |
217 | 233 |
218 private static native int nativeInit(Profile profile); | 234 private static native int nativeInit(Profile profile); |
219 private static native void nativeDestroy(int nativeForeignSessionHelper); | 235 private static native void nativeDestroy(int nativeForeignSessionHelper); |
220 private static native boolean nativeIsTabSyncEnabled(int nativeForeignSessio nHelper); | 236 private static native boolean nativeIsTabSyncEnabled(int nativeForeignSessio nHelper); |
221 private static native void nativeSetOnForeignSessionCallback( | 237 private static native void nativeSetOnForeignSessionCallback( |
222 int nativeForeignSessionHelper, ForeignSessionCallback callback); | 238 int nativeForeignSessionHelper, ForeignSessionCallback callback); |
223 private static native boolean nativeGetForeignSessions(int nativeForeignSess ionHelper, | 239 private static native boolean nativeGetForeignSessions(int nativeForeignSess ionHelper, |
224 List<ForeignSession> resultSessions); | 240 List<ForeignSession> resultSessions); |
241 // TODO (apiccion): Remvoe this method once downstream CL Lands. | |
242 // See: https://code.google.com/p/chromium/issues/detail?id=257102 | |
243 private static native boolean nativeOpenForeignSessionTabOld( | |
244 int nativeForeignSessionHelper, String sessionTag, int tabId); | |
225 private static native boolean nativeOpenForeignSessionTab( | 245 private static native boolean nativeOpenForeignSessionTab( |
226 int nativeForeignSessionHelper, String sessionTag, int tabId); | 246 int nativeForeignSessionHelper, TabBase tab, String sessionTag, int tabId); |
227 private static native void nativeSetForeignSessionCollapsed( | 247 private static native void nativeSetForeignSessionCollapsed( |
228 int nativeForeignSessionHelper, String sessionTag, boolean isCollaps ed); | 248 int nativeForeignSessionHelper, String sessionTag, boolean isCollaps ed); |
229 private static native boolean nativeGetForeignSessionCollapsed( | 249 private static native boolean nativeGetForeignSessionCollapsed( |
230 int nativeForeignSessionHelper, String sessionTag); | 250 int nativeForeignSessionHelper, String sessionTag); |
231 private static native void nativeDeleteForeignSession( | 251 private static native void nativeDeleteForeignSession( |
232 int nativeForeignSessionHelper, String sessionTag); | 252 int nativeForeignSessionHelper, String sessionTag); |
233 } | 253 } |
OLD | NEW |