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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.res.Configuration; | 9 import android.content.res.Configuration; |
10 import android.content.res.Resources; | 10 import android.content.res.Resources; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 import org.chromium.base.Log; | 42 import org.chromium.base.Log; |
43 import org.chromium.base.VisibleForTesting; | 43 import org.chromium.base.VisibleForTesting; |
44 import org.chromium.chrome.R; | 44 import org.chromium.chrome.R; |
45 import org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback; | 45 import org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback; |
46 import org.chromium.chrome.browser.favicon.FaviconHelper.IconAvailabilityCallbac k; | 46 import org.chromium.chrome.browser.favicon.FaviconHelper.IconAvailabilityCallbac k; |
47 import org.chromium.chrome.browser.favicon.LargeIconBridge.LargeIconCallback; | 47 import org.chromium.chrome.browser.favicon.LargeIconBridge.LargeIconCallback; |
48 import org.chromium.chrome.browser.ntp.LogoBridge.Logo; | 48 import org.chromium.chrome.browser.ntp.LogoBridge.Logo; |
49 import org.chromium.chrome.browser.ntp.LogoBridge.LogoObserver; | 49 import org.chromium.chrome.browser.ntp.LogoBridge.LogoObserver; |
50 import org.chromium.chrome.browser.ntp.MostVisitedItem.MostVisitedItemManager; | 50 import org.chromium.chrome.browser.ntp.MostVisitedItem.MostVisitedItemManager; |
51 import org.chromium.chrome.browser.ntp.NewTabPage.OnSearchBoxScrollListener; | 51 import org.chromium.chrome.browser.ntp.NewTabPage.OnSearchBoxScrollListener; |
52 import org.chromium.chrome.browser.ntp.NewTabPage.SelfRegistrable; | |
52 import org.chromium.chrome.browser.ntp.cards.CardsVariationParameters; | 53 import org.chromium.chrome.browser.ntp.cards.CardsVariationParameters; |
53 import org.chromium.chrome.browser.ntp.cards.NewTabPageAdapter; | 54 import org.chromium.chrome.browser.ntp.cards.NewTabPageAdapter; |
54 import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView; | 55 import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView; |
55 import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; | 56 import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; |
56 import org.chromium.chrome.browser.ntp.snippets.SnippetsConfig; | 57 import org.chromium.chrome.browser.ntp.snippets.SnippetsConfig; |
57 import org.chromium.chrome.browser.ntp.snippets.SuggestionsSource; | 58 import org.chromium.chrome.browser.ntp.snippets.SuggestionsSource; |
58 import org.chromium.chrome.browser.profiles.MostVisitedSites.MostVisitedURLsObse rver; | 59 import org.chromium.chrome.browser.profiles.MostVisitedSites.MostVisitedURLsObse rver; |
59 import org.chromium.chrome.browser.signin.SigninManager.SignInStateObserver; | |
60 import org.chromium.chrome.browser.util.MathUtils; | 60 import org.chromium.chrome.browser.util.MathUtils; |
61 import org.chromium.chrome.browser.util.ViewUtils; | 61 import org.chromium.chrome.browser.util.ViewUtils; |
62 import org.chromium.chrome.browser.widget.RoundedIconGenerator; | 62 import org.chromium.chrome.browser.widget.RoundedIconGenerator; |
63 import org.chromium.ui.base.DeviceFormFactor; | 63 import org.chromium.ui.base.DeviceFormFactor; |
64 | 64 |
65 import java.util.Arrays; | 65 import java.util.Arrays; |
66 import java.util.HashSet; | 66 import java.util.HashSet; |
67 import java.util.Set; | 67 import java.util.Set; |
68 | 68 |
69 import jp.tomorrowkey.android.gifplayer.BaseGifImage; | 69 import jp.tomorrowkey.android.gifplayer.BaseGifImage; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 void onLearnMoreClicked(); | 288 void onLearnMoreClicked(); |
289 | 289 |
290 /** | 290 /** |
291 * Returns the SuggestionsSource or null if it doesn't exist. The Sugges tionsSource is | 291 * Returns the SuggestionsSource or null if it doesn't exist. The Sugges tionsSource is |
292 * invalidated (has destroy() called) when the NewTabPage is destroyed s o use this method | 292 * invalidated (has destroy() called) when the NewTabPage is destroyed s o use this method |
293 * instead of keeping your own reference. | 293 * instead of keeping your own reference. |
294 */ | 294 */ |
295 @Nullable SuggestionsSource getSuggestionsSource(); | 295 @Nullable SuggestionsSource getSuggestionsSource(); |
296 | 296 |
297 /** | 297 /** |
298 * Registers a {@link SignInStateObserver}, will handle the de-registrat ion when the New Tab | 298 * Registers a {@link SelfRegistrable}, will be registered right away an d unregistered when |
299 * Page goes away. | 299 * when the New Tab Page goes away. |
300 * TODO(dgn): This currently supports setting only one. Extend add them to a lists if | |
Michael van Ouwerkerk
2016/10/19 12:09:18
Then maybe call it "set" instead of "add" for the
dgn
2016/10/19 17:03:41
Done.
| |
301 * needed somewhere else. | |
Bernhard Bauer
2016/10/19 12:15:27
Yeah, I would maybe call the method set...
dgn
2016/10/19 17:03:41
Done.
| |
300 */ | 302 */ |
301 void registerSignInStateObserver(SignInStateObserver signInStateObserver ); | 303 void addSelfRegistrable(SelfRegistrable selfRegistrable); |
302 | 304 |
303 /** | 305 /** |
304 * @return whether the {@link NewTabPage} associated with this manager i s the current page | 306 * @return whether the {@link NewTabPage} associated with this manager i s the current page |
305 * displayed to the user. | 307 * displayed to the user. |
306 */ | 308 */ |
307 boolean isCurrentPage(); | 309 boolean isCurrentPage(); |
308 } | 310 } |
309 | 311 |
310 /** | 312 /** |
311 * Default constructor required for XML inflation. | 313 * Default constructor required for XML inflation. |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1222 } | 1224 } |
1223 | 1225 |
1224 /** | 1226 /** |
1225 * @return The adapter position the user has scrolled to. | 1227 * @return The adapter position the user has scrolled to. |
1226 */ | 1228 */ |
1227 public int getScrollPosition() { | 1229 public int getScrollPosition() { |
1228 if (mUseCardsUi) return mRecyclerView.getScrollPosition(); | 1230 if (mUseCardsUi) return mRecyclerView.getScrollPosition(); |
1229 return RecyclerView.NO_POSITION; | 1231 return RecyclerView.NO_POSITION; |
1230 } | 1232 } |
1231 } | 1233 } |
OLD | NEW |