OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.contextmenu; | 5 package org.chromium.chrome.browser.contextmenu; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.net.MailTo; | 8 import android.net.MailTo; |
9 import android.text.TextUtils; | 9 import android.text.TextUtils; |
10 import android.view.ContextMenu; | 10 import android.view.ContextMenu; |
(...skipping 15 matching lines...) Expand all Loading... |
26 public class ChromeContextMenuPopulator implements ContextMenuPopulator { | 26 public class ChromeContextMenuPopulator implements ContextMenuPopulator { |
27 public static final int NORMAL_MODE = 0; | 27 public static final int NORMAL_MODE = 0; |
28 public static final int CUSTOM_TAB_MODE = 1; | 28 public static final int CUSTOM_TAB_MODE = 1; |
29 public static final int FULLSCREEN_TAB_MODE = 2; | 29 public static final int FULLSCREEN_TAB_MODE = 2; |
30 | 30 |
31 // Items that are included in all context menus. | 31 // Items that are included in all context menus. |
32 private static final int[] BASE_WHITELIST = { | 32 private static final int[] BASE_WHITELIST = { |
33 R.id.contextmenu_copy_link_address, | 33 R.id.contextmenu_copy_link_address, |
34 R.id.contextmenu_copy_email_address, | 34 R.id.contextmenu_copy_email_address, |
35 R.id.contextmenu_copy_link_text, | 35 R.id.contextmenu_copy_link_text, |
| 36 R.id.contextmenu_save_link_as, |
36 R.id.contextmenu_save_image, | 37 R.id.contextmenu_save_image, |
37 R.id.contextmenu_share_image, | 38 R.id.contextmenu_share_image, |
38 R.id.contextmenu_save_video, | 39 R.id.contextmenu_save_video, |
39 }; | 40 }; |
40 | 41 |
41 // Items that are included for normal Chrome browser mode. | 42 // Items that are included for normal Chrome browser mode. |
42 private static final int[] NORMAL_MODE_WHITELIST = { | 43 private static final int[] NORMAL_MODE_WHITELIST = { |
43 R.id.contextmenu_load_images, | 44 R.id.contextmenu_load_images, |
44 R.id.contextmenu_open_in_new_tab, | 45 R.id.contextmenu_open_in_new_tab, |
45 R.id.contextmenu_open_in_incognito_tab, | 46 R.id.contextmenu_open_in_incognito_tab, |
46 R.id.contextmenu_save_link_as, | 47 R.id.contextmenu_save_link_as, |
47 R.id.contextmenu_load_original_image, | 48 R.id.contextmenu_load_original_image, |
48 R.id.contextmenu_open_image, | 49 R.id.contextmenu_open_image, |
49 R.id.contextmenu_search_by_image, | 50 R.id.contextmenu_search_by_image, |
50 }; | 51 }; |
51 | 52 |
52 // Additional items for custom tabs mode. | 53 // Additional items for custom tabs mode. |
53 private static final int[] CUSTOM_TAB_MODE_WHITELIST = { | 54 private static final int[] CUSTOM_TAB_MODE_WHITELIST = { |
54 R.id.contextmenu_save_link_as, | 55 R.id.contextmenu_open_image, |
55 R.id.contextmenu_open_image | 56 R.id.contextmenu_search_by_image |
56 }; | 57 }; |
57 | 58 |
58 // Additional items for fullscreen tabs mode. | 59 // Additional items for fullscreen tabs mode. |
59 private static final int[] FULLSCREEN_TAB_MODE_WHITELIST = { | 60 private static final int[] FULLSCREEN_TAB_MODE_WHITELIST = { |
60 R.id.menu_id_open_in_chrome | 61 R.id.menu_id_open_in_chrome |
61 }; | 62 }; |
62 | 63 |
63 private final ContextMenuItemDelegate mDelegate; | 64 private final ContextMenuItemDelegate mDelegate; |
64 private MenuInflater mMenuInflater; | 65 private MenuInflater mMenuInflater; |
65 private static final String BLANK_URL = "about:blank"; | 66 private static final String BLANK_URL = "about:blank"; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 296 } |
296 | 297 |
297 return true; | 298 return true; |
298 } | 299 } |
299 | 300 |
300 private void setHeaderText(Context context, ContextMenu menu, String text) { | 301 private void setHeaderText(Context context, ContextMenu menu, String text) { |
301 ContextMenuTitleView title = new ContextMenuTitleView(context, text); | 302 ContextMenuTitleView title = new ContextMenuTitleView(context, text); |
302 menu.setHeaderView(title); | 303 menu.setHeaderView(title); |
303 } | 304 } |
304 } | 305 } |
OLD | NEW |