| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.suggestions; | 5 package org.chromium.chrome.browser.suggestions; |
| 6 | 6 |
| 7 import org.chromium.base.DiscardableReferencePool; |
| 7 import org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback; | 8 import org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback; |
| 8 import org.chromium.chrome.browser.favicon.FaviconHelper.IconAvailabilityCallbac
k; | 9 import org.chromium.chrome.browser.favicon.FaviconHelper.IconAvailabilityCallbac
k; |
| 9 import org.chromium.chrome.browser.favicon.LargeIconBridge.LargeIconCallback; | 10 import org.chromium.chrome.browser.favicon.LargeIconBridge.LargeIconCallback; |
| 10 import org.chromium.chrome.browser.ntp.snippets.SuggestionsSource; | 11 import org.chromium.chrome.browser.ntp.snippets.SuggestionsSource; |
| 11 | 12 |
| 12 /** | 13 /** |
| 13 * Interface between the suggestion surface and the rest of the browser. | 14 * Interface between the suggestion surface and the rest of the browser. |
| 14 */ | 15 */ |
| 15 public interface SuggestionsUiDelegate { | 16 public interface SuggestionsUiDelegate { |
| 16 // Dependency injection | 17 // Dependency injection |
| 17 // TODO(dgn): remove these methods once the users have a different way to ge
t a reference | 18 // TODO(dgn): remove these methods once the users have a different way to ge
t a reference |
| 18 // to these objects (https://crbug.com/677672) | 19 // to these objects (https://crbug.com/677672) |
| 19 | 20 |
| 20 /** Convenience method to access the {@link SuggestionsSource}. */ | 21 /** Convenience method to access the {@link SuggestionsSource}. */ |
| 21 SuggestionsSource getSuggestionsSource(); | 22 SuggestionsSource getSuggestionsSource(); |
| 22 | 23 |
| 23 /** Convenience method to access the {@link SuggestionsRanker}. */ | 24 /** Convenience method to access the {@link SuggestionsRanker}. */ |
| 24 SuggestionsRanker getSuggestionsRanker(); | 25 SuggestionsRanker getSuggestionsRanker(); |
| 25 | 26 |
| 26 /** Convenience method to access the {@link SuggestionsEventReporter}. */ | 27 /** Convenience method to access the {@link SuggestionsEventReporter}. */ |
| 27 SuggestionsEventReporter getEventReporter(); | 28 SuggestionsEventReporter getEventReporter(); |
| 28 | 29 |
| 29 /** Convenience method to access the {@link SuggestionsNavigationDelegate}.
*/ | 30 /** Convenience method to access the {@link SuggestionsNavigationDelegate}.
*/ |
| 30 SuggestionsNavigationDelegate getNavigationDelegate(); | 31 SuggestionsNavigationDelegate getNavigationDelegate(); |
| 31 | 32 |
| 33 /** |
| 34 * @return The reference pool to use for large objects that should be droppe
d under |
| 35 * memory pressure. |
| 36 */ |
| 37 DiscardableReferencePool getReferencePool(); |
| 38 |
| 32 // Favicons | 39 // Favicons |
| 33 | 40 |
| 34 /** | 41 /** |
| 35 * Checks if an icon with the given URL is available. If not, | 42 * Checks if an icon with the given URL is available. If not, |
| 36 * downloads it and stores it as a favicon/large icon for the given {@code p
ageUrl}. | 43 * downloads it and stores it as a favicon/large icon for the given {@code p
ageUrl}. |
| 37 * @param pageUrl The URL of the site whose icon is being requested. | 44 * @param pageUrl The URL of the site whose icon is being requested. |
| 38 * @param iconUrl The URL of the favicon/large icon. | 45 * @param iconUrl The URL of the favicon/large icon. |
| 39 * @param isLargeIcon Whether the {@code iconUrl} represents a large icon or
favicon. | 46 * @param isLargeIcon Whether the {@code iconUrl} represents a large icon or
favicon. |
| 40 * @param callback The callback to be notified when the favicon has been che
cked. | 47 * @param callback The callback to be notified when the favicon has been che
cked. |
| 41 */ | 48 */ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 58 */ | 65 */ |
| 59 void getLocalFaviconImageForURL(String url, int size, FaviconImageCallback f
aviconCallback); | 66 void getLocalFaviconImageForURL(String url, int size, FaviconImageCallback f
aviconCallback); |
| 60 | 67 |
| 61 // Feature/State checks | 68 // Feature/State checks |
| 62 | 69 |
| 63 /** | 70 /** |
| 64 * Registers a {@link DestructionObserver}, notified when the New Tab Page g
oes away. | 71 * Registers a {@link DestructionObserver}, notified when the New Tab Page g
oes away. |
| 65 */ | 72 */ |
| 66 void addDestructionObserver(DestructionObserver destructionObserver); | 73 void addDestructionObserver(DestructionObserver destructionObserver); |
| 67 | 74 |
| 68 /** @return whether the suggestions UI is currently visible. */ | 75 /** @return Whether the suggestions UI is currently visible. */ |
| 69 boolean isVisible(); | 76 boolean isVisible(); |
| 70 } | 77 } |
| OLD | NEW |