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

Side by Side Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/toolbar/HomePageButton.java

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.toolbar;
6
7 import android.content.Context;
8 import android.util.AttributeSet;
9 import android.view.ContextMenu;
10 import android.view.ContextMenu.ContextMenuInfo;
11 import android.view.Menu;
12 import android.view.MenuItem;
13 import android.view.View;
14 import android.view.View.OnCreateContextMenuListener;
15
16 import com.google.android.apps.chrome.R;
17
18 import org.chromium.chrome.browser.partnercustomizations.HomepageManager;
19 import org.chromium.chrome.browser.widget.TintedImageButton;
20
21 /**
22 * View that displays the home page button.
23 */
24 public class HomePageButton extends TintedImageButton
25 implements OnCreateContextMenuListener, MenuItem.OnMenuItemClickListener {
26
27 private static final int ID_REMOVE = 0;
28
29 /** Constructor inflating from XML. */
30 public HomePageButton(Context context, AttributeSet attrs) {
31 super(context, attrs);
32 setOnCreateContextMenuListener(this);
33 }
34
35 @Override
36 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo me nuInfo) {
37 menu.add(Menu.NONE, ID_REMOVE, Menu.NONE, R.string.remove)
38 .setOnMenuItemClickListener(this);
39 }
40
41 @Override
42 public boolean onMenuItemClick(MenuItem item) {
43 assert item.getItemId() == ID_REMOVE;
44 HomepageManager.getInstance(getContext()).setPrefHomepageEnabled(false);
45 return true;
46 }
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698