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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java

Issue 1772363002: Start using the whitelist icon on the NTP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing newt's comments Created 4 years, 9 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
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.view.ContextMenu; 7 import android.view.ContextMenu;
8 import android.view.ContextMenu.ContextMenuInfo; 8 import android.view.ContextMenu.ContextMenuInfo;
9 import android.view.MenuItem; 9 import android.view.MenuItem;
10 import android.view.MenuItem.OnMenuItemClickListener; 10 import android.view.MenuItem.OnMenuItemClickListener;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 * @param menuId Id of the menu item that was selected. 42 * @param menuId Id of the menu item that was selected.
43 * @param item MostVisitedItem that triggered the context menu. 43 * @param item MostVisitedItem that triggered the context menu.
44 * @return Whether a menu item was selected successfully. 44 * @return Whether a menu item was selected successfully.
45 */ 45 */
46 boolean onMenuItemClick(int menuId, MostVisitedItem item); 46 boolean onMenuItemClick(int menuId, MostVisitedItem item);
47 } 47 }
48 48
49 private MostVisitedItemManager mManager; 49 private MostVisitedItemManager mManager;
50 private String mTitle; 50 private String mTitle;
51 private String mUrl; 51 private String mUrl;
52 private String mWhitelistIconPath;
52 private boolean mOfflineAvailable; 53 private boolean mOfflineAvailable;
53 private int mIndex; 54 private int mIndex;
54 private int mTileType; 55 private int mTileType;
55 private View mView; 56 private View mView;
56 57
57 /** 58 /**
58 * Constructs a MostVisitedItem with the given manager, title, URL, index, a nd view. 59 * Constructs a MostVisitedItem with the given manager, title, URL, whitelis t icon path, index,
60 * and
61 * view.
Marc Treib 2016/03/16 11:06:03 nit: merge into the previous line please.
atanasova 2016/03/16 17:58:17 Done.
59 * 62 *
60 * @param manager The NewTabPageManager used to handle clicks and context me nu events. 63 * @param manager The NewTabPageManager used to handle clicks and context me nu events.
61 * @param title The title of the page. 64 * @param title The title of the page.
62 * @param url The URL of the page. 65 * @param url The URL of the page.
66 * @param whitelistIconPath The path to the icon image file, if this is a wh itelisted most
67 * visited item. Empty otherwise.
63 * @param offlineAvailable Whether there is an offline copy of the URL avail able. 68 * @param offlineAvailable Whether there is an offline copy of the URL avail able.
64 * @param index The index of this item in the list of most visited items. 69 * @param index The index of this item in the list of most visited items.
65 */ 70 */
66 public MostVisitedItem(MostVisitedItemManager manager, String title, String url, 71 public MostVisitedItem(MostVisitedItemManager manager, String title, String url,
67 boolean offlineAvailable, int index) { 72 String whitelistIconPath, boolean offlineAvailable, int index) {
68 mManager = manager; 73 mManager = manager;
69 mTitle = title; 74 mTitle = title;
70 mUrl = url; 75 mUrl = url;
76 mWhitelistIconPath = whitelistIconPath;
71 mOfflineAvailable = offlineAvailable; 77 mOfflineAvailable = offlineAvailable;
72 mIndex = index; 78 mIndex = index;
73 mTileType = MostVisitedTileType.NONE; 79 mTileType = MostVisitedTileType.NONE;
74 } 80 }
75 81
76 /** 82 /**
77 * Sets the view that will display this item. MostVisitedItem will handle cl icks on the view. 83 * Sets the view that will display this item. MostVisitedItem will handle cl icks on the view.
78 * This should be called exactly once. 84 * This should be called exactly once.
79 */ 85 */
80 public void initView(View view) { 86 public void initView(View view) {
(...skipping 18 matching lines...) Expand all
99 } 105 }
100 106
101 /** 107 /**
102 * @return The title of this most visited item. 108 * @return The title of this most visited item.
103 */ 109 */
104 public String getTitle() { 110 public String getTitle() {
105 return mTitle; 111 return mTitle;
106 } 112 }
107 113
108 /** 114 /**
115 * @return The path of the whitelist icon associated with the URL.
116 */
117 public String getWhitelistIconPath() {
118 return mWhitelistIconPath;
119 }
120
121 /**
109 * @return Whether this item is available offline. 122 * @return Whether this item is available offline.
110 */ 123 */
111 public boolean isOfflineAvailable() { 124 public boolean isOfflineAvailable() {
112 return mOfflineAvailable; 125 return mOfflineAvailable;
113 } 126 }
114 127
115 /** 128 /**
116 * @return The index of this MostVisitedItem in the list of MostVisitedItems . 129 * @return The index of this MostVisitedItem in the list of MostVisitedItems .
117 */ 130 */
118 public int getIndex() { 131 public int getIndex() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 @Override 163 @Override
151 public boolean onMenuItemClick(MenuItem item) { 164 public boolean onMenuItemClick(MenuItem item) {
152 return mManager.onMenuItemClick(item.getItemId(), this); 165 return mManager.onMenuItemClick(item.getItemId(), this);
153 } 166 }
154 167
155 @Override 168 @Override
156 public void onClick(View v) { 169 public void onClick(View v) {
157 mManager.open(this); 170 mManager.open(this);
158 } 171 }
159 } 172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698