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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 import org.chromium.chrome.browser.ntp.NewTabPage.OnSearchBoxScrollListener; | 52 import org.chromium.chrome.browser.ntp.NewTabPage.OnSearchBoxScrollListener; |
53 import org.chromium.chrome.browser.ntp.cards.CardsVariationParameters; | 53 import org.chromium.chrome.browser.ntp.cards.CardsVariationParameters; |
54 import org.chromium.chrome.browser.ntp.cards.NewTabPageAdapter; | 54 import org.chromium.chrome.browser.ntp.cards.NewTabPageAdapter; |
55 import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView; | 55 import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView; |
56 import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; | 56 import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; |
57 import org.chromium.chrome.browser.ntp.snippets.SnippetsConfig; | 57 import org.chromium.chrome.browser.ntp.snippets.SnippetsConfig; |
58 import org.chromium.chrome.browser.ntp.snippets.SuggestionsSource; | 58 import org.chromium.chrome.browser.ntp.snippets.SuggestionsSource; |
59 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; | 59 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; |
60 import org.chromium.chrome.browser.profiles.MostVisitedSites.MostVisitedURLsObse
rver; | 60 import org.chromium.chrome.browser.profiles.MostVisitedSites.MostVisitedURLsObse
rver; |
61 import org.chromium.chrome.browser.profiles.Profile; | 61 import org.chromium.chrome.browser.profiles.Profile; |
| 62 import org.chromium.chrome.browser.suggestions.SuggestionsMetricsReporter; |
62 import org.chromium.chrome.browser.tab.Tab; | 63 import org.chromium.chrome.browser.tab.Tab; |
63 import org.chromium.chrome.browser.util.MathUtils; | 64 import org.chromium.chrome.browser.util.MathUtils; |
64 import org.chromium.chrome.browser.util.ViewUtils; | 65 import org.chromium.chrome.browser.util.ViewUtils; |
65 import org.chromium.chrome.browser.widget.RoundedIconGenerator; | 66 import org.chromium.chrome.browser.widget.RoundedIconGenerator; |
66 import org.chromium.ui.base.DeviceFormFactor; | 67 import org.chromium.ui.base.DeviceFormFactor; |
67 | 68 |
68 import java.util.Arrays; | 69 import java.util.Arrays; |
69 import java.util.HashSet; | 70 import java.util.HashSet; |
70 import java.util.Set; | 71 import java.util.Set; |
71 | 72 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 /** Opens the bookmarks page in the current tab. */ | 158 /** Opens the bookmarks page in the current tab. */ |
158 void navigateToBookmarks(); | 159 void navigateToBookmarks(); |
159 | 160 |
160 /** Opens the recent tabs page in the current tab. */ | 161 /** Opens the recent tabs page in the current tab. */ |
161 void navigateToRecentTabs(); | 162 void navigateToRecentTabs(); |
162 | 163 |
163 /** Opens the Download Manager UI in the current tab. */ | 164 /** Opens the Download Manager UI in the current tab. */ |
164 void navigateToDownloadManager(); | 165 void navigateToDownloadManager(); |
165 | 166 |
166 /** | 167 /** |
167 * Tracks per-page-load metrics for content suggestions. | |
168 * @param categories The categories of content suggestions. | |
169 * @param suggestionsPerCategory The number of content suggestions in ea
ch category. | |
170 */ | |
171 void trackSnippetsPageImpression(int[] categories, int[] suggestionsPerC
ategory); | |
172 | |
173 /** | |
174 * Tracks impression metrics for a content suggestion. | |
175 * @param article The content suggestion that was shown to the user. | |
176 */ | |
177 void trackSnippetImpression(SnippetArticle article); | |
178 | |
179 /** | |
180 * Tracks impression metrics for the long-press menu for a content sugge
stion. | |
181 * @param article The content suggestion for which the long-press menu w
as opened. | |
182 */ | |
183 void trackSnippetMenuOpened(SnippetArticle article); | |
184 | |
185 /** | |
186 * Tracks impression metrics for a category's action button ("More"). | |
187 * @param category The category for which the action button was shown. | |
188 * @param position The position of the action button within the category
. | |
189 */ | |
190 void trackSnippetCategoryActionImpression(int category, int position); | |
191 | |
192 /** | |
193 * Tracks click metrics for a category's action button ("More"). | |
194 * @param category The category for which the action button was clicked. | |
195 * @param position The position of the action button within the category
. | |
196 */ | |
197 void trackSnippetCategoryActionClick(int category, int position); | |
198 | |
199 /** | |
200 * Opens a content suggestion and records related metrics. | 168 * Opens a content suggestion and records related metrics. |
201 * @param windowOpenDisposition How to open (current tab, new tab, new w
indow etc). | 169 * @param windowOpenDisposition How to open (current tab, new tab, new w
indow etc). |
202 * @param article The content suggestion to open. | 170 * @param article The content suggestion to open. |
203 */ | 171 */ |
204 void openSnippet(int windowOpenDisposition, SnippetArticle article); | 172 void openSnippet(int windowOpenDisposition, SnippetArticle article); |
205 | 173 |
206 /** | 174 /** |
207 * Animates the search box up into the omnibox and bring up the keyboard
. | 175 * Animates the search box up into the omnibox and bring up the keyboard
. |
208 * @param beginVoiceSearch Whether to begin a voice search. | 176 * @param beginVoiceSearch Whether to begin a voice search. |
209 * @param pastedText Text to paste in the omnibox after it's been focuse
d. May be null. | 177 * @param pastedText Text to paste in the omnibox after it's been focuse
d. May be null. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 * displayed to the user. | 261 * displayed to the user. |
294 */ | 262 */ |
295 boolean isCurrentPage(); | 263 boolean isCurrentPage(); |
296 | 264 |
297 /** | 265 /** |
298 * @return The context menu manager. Will be {@code null} if the {@link
NewTabPageView} is | 266 * @return The context menu manager. Will be {@code null} if the {@link
NewTabPageView} is |
299 * not done initialising. | 267 * not done initialising. |
300 */ | 268 */ |
301 @Nullable | 269 @Nullable |
302 ContextMenuManager getContextMenuManager(); | 270 ContextMenuManager getContextMenuManager(); |
| 271 |
| 272 /** |
| 273 * @return The suggestion metrics reporter. Will be {@code null} if the |
| 274 * {@link NewTabPageView} is not done initialising. |
| 275 */ |
| 276 @Nullable |
| 277 SuggestionsMetricsReporter getSuggestionsMetricsReporter(); |
303 } | 278 } |
304 | 279 |
305 /** | 280 /** |
306 * Default constructor required for XML inflation. | 281 * Default constructor required for XML inflation. |
307 */ | 282 */ |
308 public NewTabPageView(Context context, AttributeSet attrs) { | 283 public NewTabPageView(Context context, AttributeSet attrs) { |
309 super(context, attrs); | 284 super(context, attrs); |
310 } | 285 } |
311 | 286 |
312 /** | 287 /** |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 public int getScrollPosition() { | 1219 public int getScrollPosition() { |
1245 if (mUseCardsUi) return mRecyclerView.getScrollPosition(); | 1220 if (mUseCardsUi) return mRecyclerView.getScrollPosition(); |
1246 return RecyclerView.NO_POSITION; | 1221 return RecyclerView.NO_POSITION; |
1247 } | 1222 } |
1248 | 1223 |
1249 /** @return the context menu manager. */ | 1224 /** @return the context menu manager. */ |
1250 public ContextMenuManager getContextMenuManager() { | 1225 public ContextMenuManager getContextMenuManager() { |
1251 return mContextMenuManager; | 1226 return mContextMenuManager; |
1252 } | 1227 } |
1253 } | 1228 } |
OLD | NEW |