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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsCustomContextMenuItem.java

Issue 2815453002: [Android] Show Browser Actions dialog in Chrome (Closed)
Patch Set: Update based on Ted's comments. Created 3 years, 8 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/src/org/chromium/chrome/browser/browseractions/BrowserActionsCustomContextMenuItem.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsCustomContextMenuItem.java b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsCustomContextMenuItem.java
new file mode 100644
index 0000000000000000000000000000000000000000..36a3ccd65abd76b35abd89ecd9a499380e8977bd
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsCustomContextMenuItem.java
@@ -0,0 +1,45 @@
+// Copyright 2017 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.browseractions;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.support.annotation.IdRes;
+import android.support.customtabs.browseractions.BrowserActionItem;
+
+import org.chromium.chrome.browser.contextmenu.ContextMenuItem;
+
+/**
+ * A class represents Browser Actions context menu with custom title and icon.
+ */
+public class BrowserActionsCustomContextMenuItem implements ContextMenuItem {
+ @IdRes
+ private final int mMenuId;
+ private final String mTitle;
+ private final Bitmap mIcon;
+
+ BrowserActionsCustomContextMenuItem(@IdRes int id, BrowserActionItem item) {
Ted C 2017/04/19 19:58:41 javadoc for this
ltian 2017/04/21 05:10:54 Done.
+ mMenuId = id;
+ mTitle = item.getTitle();
+ mIcon = item.getIcon();
+ }
+
+ @Override
+ public int getMenuId() {
+ return mMenuId;
+ }
+
+ @Override
+ public String getTitle(Context context) {
+ return mTitle;
+ }
+
+ @Override
+ public Drawable getDrawableAndDescription(Context context) {
+ return new BitmapDrawable(context.getResources(), mIcon);
Ted C 2017/04/19 19:58:41 I "think" we might want to cache this drawable. C
ltian 2017/04/21 05:10:54 Sorry I am not sure how should we cache this drawa
ltian 2017/04/26 23:44:40 Looks like the BitmapDrawable stores the reference
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698