Chromium Code Reviews| 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.annotations.CalledByNative; | 7 import org.chromium.base.annotations.CalledByNative; |
| 8 import org.chromium.chrome.browser.ntp.MostVisitedTileType; | |
| 9 import org.chromium.chrome.browser.ntp.NTPTileSource; | |
| 10 | 8 |
| 11 /** | 9 /** |
| 12 * Methods to provide most recent urls, titles and thumbnails. | 10 * Methods to provide most recent urls, titles and thumbnails. |
| 13 */ | 11 */ |
| 14 interface MostVisitedSites { | 12 interface MostVisitedSites { |
| 15 /** | 13 /** |
| 16 * An interface for handling events in {@link MostVisitedSites}. | 14 * An interface for handling events in {@link MostVisitedSites}. |
| 17 */ | 15 */ |
| 18 interface Observer { | 16 interface Observer { |
| 19 /** | 17 /** |
| 20 * This is called when the list of most visited URLs is initially availa ble or updated. | 18 * This is called when the list of most visited URLs is initially availa ble or updated. |
| 21 * Parameters guaranteed to be non-null. | 19 * Parameters guaranteed to be non-null. |
| 22 * | 20 * |
| 23 * @param titles Array of most visited url page titles. | 21 * @param titles Array of most visited url page titles. |
| 24 * @param urls Array of most visited URLs, including popular URLs if | 22 * @param urls Array of most visited URLs, including popular URLs if |
| 25 * available and necessary (i.e. there aren't enough most | 23 * available and necessary (i.e. there aren't enough most |
| 26 * visited URLs). | 24 * visited URLs). |
| 27 * @param whitelistIconPaths The paths to the icon image files for white listed tiles, empty | 25 * @param whitelistIconPaths The paths to the icon image files for white listed tiles, empty |
| 28 * strings otherwise. | 26 * strings otherwise. |
| 29 * @param sources For each tile, the {@code NTPTileSource} that generate d the tile. | 27 * @param sources For each tile, the {@code TileSource} that generated t he tile. |
| 30 */ | 28 */ |
| 31 @CalledByNative("Observer") | 29 @CalledByNative("Observer") |
| 32 void onMostVisitedURLsAvailable( | 30 void onMostVisitedURLsAvailable( |
| 33 String[] titles, String[] urls, String[] whitelistIconPaths, int [] sources); | 31 String[] titles, String[] urls, String[] whitelistIconPaths, int [] sources); |
| 34 | 32 |
| 35 /** | 33 /** |
| 36 * This is called when a previously uncached icon has been fetched. | 34 * This is called when a previously uncached icon has been fetched. |
| 37 * Parameters guaranteed to be non-null. | 35 * Parameters guaranteed to be non-null. |
| 38 * | 36 * |
| 39 * @param siteUrl URL of site with newly-cached icon. | 37 * @param siteUrl URL of site with newly-cached icon. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 61 void addBlacklistedUrl(String url); | 59 void addBlacklistedUrl(String url); |
| 62 | 60 |
| 63 /** | 61 /** |
| 64 * Removes a URL from the most visited URLs blacklist. | 62 * Removes a URL from the most visited URLs blacklist. |
| 65 */ | 63 */ |
| 66 void removeBlacklistedUrl(String url); | 64 void removeBlacklistedUrl(String url); |
| 67 | 65 |
| 68 /** | 66 /** |
| 69 * Records metrics about an impression, including the sources (local, server , ...) and visual | 67 * Records metrics about an impression, including the sources (local, server , ...) and visual |
| 70 * types of the tiles that are shown. | 68 * types of the tiles that are shown. |
| 71 * @param tileTypes An array of values from MostVisitedTileType indicating t he type of each | 69 * @param tileTypes An array of values from {@link TileVisualType} indicatin g the type of each |
| 72 * tile that's currently showing. | 70 * tile that's currently showing. |
| 73 * @param sources An array of values from NTPTileSource indicating the sourc e of each tile | 71 * @param sources An array of values from {@link TileSource} indicating the source of each tile |
| 74 * that's currently showing. | 72 * that's currently showing. |
| 75 * @param tileUrls An array of strings indicating the URL of each tile. | 73 * @param tileUrls An array of strings indicating the URL of each tile. |
| 76 */ | 74 */ |
| 77 void recordPageImpression(int[] tileTypes, int[] sources, String[] tileUrls) ; | 75 void recordPageImpression(int[] tileTypes, int[] sources, String[] tileUrls) ; |
| 78 | 76 |
| 79 /** | 77 /** |
| 80 * Records the opening of a Most Visited Item. | 78 * Records the opening of a Most Visited Item. |
| 81 * @param index The index of the item that was opened. | 79 * @param index The index of the item that was opened. |
| 82 * @param type The visual type of the item as defined in {@code MostVisitedT ileType}. | 80 * @param type The visual type of the item as defined in {@link TileVisualTy pe}. |
| 83 * @param source The {@code NTPTileSource} that generated this item. | 81 * @param source The {@link TileSource} that generated this item. |
| 84 */ | 82 */ |
| 85 void recordOpenedMostVisitedItem(int index, | 83 void recordOpenedMostVisitedItem(int index, @TileVisualType.TileVisualTypeEn um int type, |
|
Michael van Ouwerkerk
2017/04/03 13:35:59
Cool, and this will be further simplified to @Tile
| |
| 86 @MostVisitedTileType.MostVisitedTileTypeEnum int type, | 84 @TileSource.TileSourceEnum int source); |
| 87 @NTPTileSource.NTPTileSourceEnum int source); | |
| 88 } | 85 } |
| OLD | NEW |