OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.ntp; | 5 package org.chromium.chrome.browser.ntp; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.SharedPreferences; | 8 import android.content.SharedPreferences; |
9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
10 | 10 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 postUpdate(); | 157 postUpdate(); |
158 } | 158 } |
159 }); | 159 }); |
160 } | 160 } |
161 | 161 |
162 private void registerForSignInAndSyncNotifications() { | 162 private void registerForSignInAndSyncNotifications() { |
163 AndroidSyncSettings.registerObserver(mContext, this); | 163 AndroidSyncSettings.registerObserver(mContext, this); |
164 mSignInManager.addSignInStateObserver(this); | 164 mSignInManager.addSignInStateObserver(this); |
165 } | 165 } |
166 | 166 |
167 protected void updateCurrentlyOpenTabs() { | |
168 } | |
169 | |
170 private void updateRecentlyClosedTabs() { | 167 private void updateRecentlyClosedTabs() { |
171 mRecentlyClosedTabs = mRecentlyClosedBridge.getRecentlyClosedTabs( | 168 mRecentlyClosedTabs = mRecentlyClosedBridge.getRecentlyClosedTabs( |
172 RECENTLY_CLOSED_MAX_TAB_COUNT); | 169 RECENTLY_CLOSED_MAX_TAB_COUNT); |
173 } | 170 } |
174 | 171 |
175 private void updateForeignSessions() { | 172 private void updateForeignSessions() { |
176 mForeignSessions = mForeignSessionHelper.getForeignSessions(); | 173 mForeignSessions = mForeignSessionHelper.getForeignSessions(); |
177 if (mForeignSessions == null) { | 174 if (mForeignSessions == null) { |
178 mForeignSessions = Collections.emptyList(); | 175 mForeignSessions = Collections.emptyList(); |
179 } | 176 } |
180 } | 177 } |
181 | 178 |
182 /** | 179 /** |
183 * @return Most up-to-date list of currently open tabs. | |
184 */ | |
185 public List<CurrentlyOpenTab> getCurrentlyOpenTabs() { | |
186 return null; | |
187 } | |
188 | |
189 /** | |
190 * @return Most up-to-date list of foreign sessions. | 180 * @return Most up-to-date list of foreign sessions. |
191 */ | 181 */ |
192 public List<ForeignSession> getForeignSessions() { | 182 public List<ForeignSession> getForeignSessions() { |
193 return mForeignSessions; | 183 return mForeignSessions; |
194 } | 184 } |
195 | 185 |
196 /** | 186 /** |
197 * @return Most up-to-date list of recently closed tabs. | 187 * @return Most up-to-date list of recently closed tabs. |
198 */ | 188 */ |
199 public List<RecentlyClosedTab> getRecentlyClosedTabs() { | 189 public List<RecentlyClosedTab> getRecentlyClosedTabs() { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 * Sets a callback to be invoked when recently closed tabs or foreign sessio
ns documents have | 254 * Sets a callback to be invoked when recently closed tabs or foreign sessio
ns documents have |
265 * been updated. | 255 * been updated. |
266 * | 256 * |
267 * @param updatedCallback the listener to be invoked. | 257 * @param updatedCallback the listener to be invoked. |
268 */ | 258 */ |
269 public void setUpdatedCallback(UpdatedCallback updatedCallback) { | 259 public void setUpdatedCallback(UpdatedCallback updatedCallback) { |
270 mUpdatedCallback = updatedCallback; | 260 mUpdatedCallback = updatedCallback; |
271 } | 261 } |
272 | 262 |
273 /** | 263 /** |
274 * Sets the persistent expanded/collapsed state of the currently open tabs l
ist. | |
275 * | |
276 * @param isCollapsed Whether the currently open tabs list is collapsed. | |
277 */ | |
278 public void setCurrentlyOpenTabsCollapsed(boolean isCollapsed) { | |
279 if (mIsDestroyed) return; | |
280 mNewTabPagePrefs.setCurrentlyOpenTabsCollapsed(isCollapsed); | |
281 } | |
282 | |
283 /** | |
284 * Determine the expanded/collapsed state of the currently open tabs list. | |
285 * | |
286 * @return Whether the currently open tabs list is collapsed. | |
287 */ | |
288 public boolean isCurrentlyOpenTabsCollapsed() { | |
289 return mNewTabPagePrefs.getCurrentlyOpenTabsCollapsed(); | |
290 } | |
291 | |
292 /** | |
293 * Sets the state for showing all tabs in the currently open tabs list. This
is intended to | |
294 * be overridden in extending classes and set to true when the user clicks t
he "More" button | |
295 * at the end of the list. | |
296 * @param showingAll Whether the currently open tabs list should start to sh
ow all. | |
297 */ | |
298 public void setCurrentlyOpenTabsShowAll(boolean showingAll) { | |
299 } | |
300 | |
301 /** | |
302 * @return Whether the currently open tabs group shows all tabs. If it is no
t, only a limited | |
303 * number of tabs is shown with a "More" button at the end of the list to sh
ow all. | |
304 */ | |
305 public boolean isCurrentlyOpenTabsShowingAll() { | |
306 return false; | |
307 } | |
308 | |
309 /** | |
310 * Closes the specified currently open tab. | |
311 * @param tab Information about the tab that should be closed. | |
312 */ | |
313 public void closeTab(CurrentlyOpenTab tab) { | |
314 } | |
315 | |
316 /** | |
317 * Sets the persistent expanded/collapsed state of a foreign session list. | 264 * Sets the persistent expanded/collapsed state of a foreign session list. |
318 * | 265 * |
319 * @param session foreign session to collapsed. | 266 * @param session foreign session to collapsed. |
320 * @param isCollapsed Whether the session is collapsed or expanded. | 267 * @param isCollapsed Whether the session is collapsed or expanded. |
321 */ | 268 */ |
322 public void setForeignSessionCollapsed(ForeignSession session, boolean isCol
lapsed) { | 269 public void setForeignSessionCollapsed(ForeignSession session, boolean isCol
lapsed) { |
323 if (mIsDestroyed) return; | 270 if (mIsDestroyed) return; |
324 mNewTabPagePrefs.setForeignSessionCollapsed(session, isCollapsed); | 271 mNewTabPagePrefs.setForeignSessionCollapsed(session, isCollapsed); |
325 } | 272 } |
326 | 273 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 updateForeignSessions(); | 396 updateForeignSessions(); |
450 postUpdate(); | 397 postUpdate(); |
451 } | 398 } |
452 }); | 399 }); |
453 } | 400 } |
454 | 401 |
455 public boolean isSignedIn() { | 402 public boolean isSignedIn() { |
456 return ChromeSigninController.get(mContext).isSignedIn(); | 403 return ChromeSigninController.get(mContext).isSignedIn(); |
457 } | 404 } |
458 } | 405 } |
OLD | NEW |