Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsUiDelegate.java

Issue 2623993007: 🏠 Extract the ContentSuggestionManager interface from NTP (Closed)
Patch Set: fix destruction of snippets bridge Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.suggestions;
6
7 import android.support.annotation.Nullable;
8
9 import org.chromium.base.Callback;
10 import org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback;
11 import org.chromium.chrome.browser.favicon.FaviconHelper.IconAvailabilityCallbac k;
12 import org.chromium.chrome.browser.favicon.LargeIconBridge.LargeIconCallback;
13 import org.chromium.chrome.browser.ntp.NewTabPage.DestructionObserver;
14 import org.chromium.chrome.browser.ntp.snippets.SuggestionsSource;
15
16 import java.util.Set;
17
18 /**
19 * Interface between the suggestion surface and the rest of the browser.
20 */
21 public interface SuggestionsUiDelegate {
Bernhard Bauer 2017/01/16 11:08:37 I like how small this interface is becoming :)
22 // Dependency injection
Michael van Ouwerkerk 2017/01/16 15:31:15 Is your plan to inject these dependencies directly
dgn 2017/01/18 16:22:27 Done.
23
24 /**
25 * Returns the SuggestionsSource or {@code null} if it doesn't exist. The Su ggestionsSource is
26 * invalidated (has destroy() called) when the suggestion surface is destroy ed so use this
27 * method instead of keeping your own reference.
28 */
29 @Nullable
30 SuggestionsSource getSuggestionsSource();
31
32 /**
33 * Returns the MetricsReporter or {@code null} if it doesn't exist. The
34 * SuggestionsMetricsReporter is invalidated (has destroy() called) when the suggestion surface
35 * is destroyed so use this method instead of keeping your own reference.
36 */
37 @Nullable
38 SuggestionsMetricsReporter getMetricsReporter();
39
40 /**
41 * Returns the NavigationDelegate or {@code null} if it doesn't exist. The
42 * SuggestionsNavigationDelegate is invalidated (has destroy() called) when the suggestion
43 * surface is destroyed so use this method instead of keeping your own refer ence.
44 */
45 @Nullable
46 SuggestionsNavigationDelegate getNavigationDelegate();
47
48 // Favicons
49
50 /**
51 * Checks if an icon with the given URL is available. If not,
52 * downloads it and stores it as a favicon/large icon for the given {@code p ageUrl}.
53 * @param pageUrl The URL of the site whose icon is being requested.
54 * @param iconUrl The URL of the favicon/large icon.
55 * @param isLargeIcon Whether the {@code iconUrl} represents a large icon or favicon.
56 * @param callback The callback to be notified when the favicon has been che cked.
57 */
58 void ensureIconIsAvailable(String pageUrl, String iconUrl, boolean isLargeIc on,
59 boolean isTemporary, IconAvailabilityCallback callback);
60
61 /**
62 * Gets the large icon (e.g. favicon or touch icon) for a given URL.
63 * @param url The URL of the site whose icon is being requested.
64 * @param size The desired size of the icon in pixels.
65 * @param callback The callback to be notified when the icon is available.
66 */
67 void getLargeIconForUrl(String url, int size, LargeIconCallback callback);
68
69 /**
70 * Gets the favicon image for a given URL.
71 * @param url The URL of the site whose favicon is being requested.
72 * @param size The desired size of the favicon in pixels.
73 * @param faviconCallback The callback to be notified when the favicon is av ailable.
74 */
75 void getLocalFaviconImageForURL(String url, int size, FaviconImageCallback f aviconCallback);
76
77 // Feature/State checks
78
79 /**
80 * Registers a {@link DestructionObserver}, notified when the New Tab Page g oes away.
81 */
82 void addDestructionObserver(DestructionObserver destructionObserver);
83
84 // Offline
85
86 /**
87 * Checks if the pages with the given URLs are available offline.
88 * @param pageUrls The URLs of the sites whose offline availability is reque sted.
89 * @param callback Fired when the results are available.
90 */
91 void getUrlsAvailableOffline(Set<String> pageUrls, Callback<Set<String>> cal lback);
92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698