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

Unified Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java

Issue 1206673003: Merge java_staging/src into java/src. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java_staging/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java
diff --git a/chrome/android/java_staging/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java b/chrome/android/java_staging/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java
deleted file mode 100644
index 042c5c153f05f105ea4cb07c14f80c2d938adfd1..0000000000000000000000000000000000000000
--- a/chrome/android/java_staging/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.ntp;
-
-import android.view.ContextMenu;
-import android.view.ContextMenu.ContextMenuInfo;
-import android.view.MenuItem;
-import android.view.MenuItem.OnMenuItemClickListener;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnCreateContextMenuListener;
-
-/**
- * Displays the title, thumbnail, and favicon of a most visited page. The item can be clicked, or
- * long-pressed to trigger a context menu with options to "open in new tab", "open in incognito
- * tab", or "remove".
- */
-public class MostVisitedItem implements OnCreateContextMenuListener,
- MenuItem.OnMenuItemClickListener, OnClickListener {
-
- private MostVisitedItemManager mManager;
- private String mTitle;
- private String mUrl;
- private int mIndex;
- private View mView;
-
- /**
- * Interface for an object that handles callbacks from a MostVisitedItem.
- */
- public interface MostVisitedItemManager {
- /**
- * Navigates to a most visited page in the existing tab.
- * @param item The most visited item to open.
- */
- void open(MostVisitedItem item);
-
- /**
- * Allows the manager to add context menu items for a given MostVisitedItem.
- * @param menu The context menu that should be used to add menu items.
- * @param listener Listener that should get the callbacks for context menu selections.
- */
- void onCreateContextMenu(ContextMenu menu, OnMenuItemClickListener listener);
-
- /**
- * Handles context menu item clicks.
- * @param menuId Id of the menu item that was selected.
- * @param item MostVisitedItem that triggered the context menu.
- * @return Whether a menu item was selected successfully.
- */
- boolean onMenuItemClick(int menuId, MostVisitedItem item);
- }
-
- /**
- * Constructs a MostVisitedItem with the given manager, title, URL, index, and view.
- *
- * @param manager The NewTabPageManager used to handle clicks and context menu events.
- * @param title The title of the page.
- * @param url The URL of the page.
- * @param index The index of this item in the list of most visited items.
- * @param view The View that will display the item. The MostVisitedItem will handle clicks
- * on this view.
- */
- public MostVisitedItem(MostVisitedItemManager manager, String title, String url, int index,
- View view) {
- mManager = manager;
- mTitle = title;
- mUrl = url;
- mIndex = index;
- mView = view;
- mView.setOnClickListener(this);
- mView.setOnCreateContextMenuListener(this);
- }
-
- /**
- * @return The view representing this item.
- */
- public View getView() {
- return mView;
- }
-
- /**
- * @return The URL of this most visited item.
- */
- public String getUrl() {
- return mUrl;
- }
-
- /**
- * @return The title of this most visited item.
- */
- public String getTitle() {
- return mTitle;
- }
-
- /**
- * @return The index of this MostVisitedItem in the list of MostVisitedItems.
- */
- public int getIndex() {
- return mIndex;
- }
-
- /**
- * Updates this item's index in the list of most visited items.
- */
- public void setIndex(int index) {
- mIndex = index;
- }
-
- @Override
- public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
- mManager.onCreateContextMenu(menu, this);
- }
-
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- return mManager.onMenuItemClick(item.getItemId(), this);
- }
-
- @Override
- public void onClick(View v) {
- mManager.open(this);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698