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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java

Issue 398803002: Context menu for image is not having any option to copy image URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 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.os.Build; 8 import android.os.Build;
9 import android.text.TextUtils; 9 import android.text.TextUtils;
10 import android.view.ContextMenu; 10 import android.view.ContextMenu;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } else if (params.isImage()) { 68 } else if (params.isImage()) {
69 menu.findItem(R.id.contextmenu_save_image).setEnabled( 69 menu.findItem(R.id.contextmenu_save_image).setEnabled(
70 UrlUtilities.isDownloadableScheme(params.getSrcUrl())); 70 UrlUtilities.isDownloadableScheme(params.getSrcUrl()));
71 71
72 if (mDelegate.canLoadOriginalImage()) { 72 if (mDelegate.canLoadOriginalImage()) {
73 menu.findItem(R.id.contextmenu_open_image_in_new_tab).setVisible (false); 73 menu.findItem(R.id.contextmenu_open_image_in_new_tab).setVisible (false);
74 } else { 74 } else {
75 menu.findItem(R.id.contextmenu_open_original_image_in_new_tab).s etVisible(false); 75 menu.findItem(R.id.contextmenu_open_original_image_in_new_tab).s etVisible(false);
76 } 76 }
77 77
78 // Avoid showing open image option for same image which is already o pened.
79 if (mDelegate.getPageUrl().equals(params.getSrcUrl())) {
80 menu.findItem(R.id.contextmenu_open_image).setVisible(false);
81 }
Bernhard Bauer 2014/07/16 13:21:57 This is from a different CL.
78 final TemplateUrlService templateUrlServiceInstance = TemplateUrlSer vice.getInstance(); 82 final TemplateUrlService templateUrlServiceInstance = TemplateUrlSer vice.getInstance();
79 final boolean isSearchByImageAvailable = 83 final boolean isSearchByImageAvailable =
80 UrlUtilities.isDownloadableScheme(params.getSrcUrl()) && 84 UrlUtilities.isDownloadableScheme(params.getSrcUrl()) &&
81 templateUrlServiceInstance.isLoaded() && 85 templateUrlServiceInstance.isLoaded() &&
82 templateUrlServiceInstance.isSearchByImageAvailable( ) && 86 templateUrlServiceInstance.isSearchByImageAvailable( ) &&
83 templateUrlServiceInstance.getDefaultSearchEngineTem plateUrl() != null; 87 templateUrlServiceInstance.getDefaultSearchEngineTem plateUrl() != null;
84 88
85 menu.findItem(R.id.contextmenu_search_by_image).setVisible(isSearchB yImageAvailable); 89 menu.findItem(R.id.contextmenu_search_by_image).setVisible(isSearchB yImageAvailable);
86 if (isSearchByImageAvailable) { 90 if (isSearchByImageAvailable) {
87 menu.findItem(R.id.contextmenu_search_by_image).setTitle( 91 menu.findItem(R.id.contextmenu_search_by_image).setTitle(
(...skipping 24 matching lines...) Expand all
112 mDelegate.onSaveToClipboard(params.getLinkText(), false); 116 mDelegate.onSaveToClipboard(params.getLinkText(), false);
113 } else if (itemId == R.id.contextmenu_save_image || 117 } else if (itemId == R.id.contextmenu_save_image ||
114 itemId == R.id.contextmenu_save_video) { 118 itemId == R.id.contextmenu_save_video) {
115 if (mDelegate.startDownload(false)) helper.startContextMenuDownload( false); 119 if (mDelegate.startDownload(false)) helper.startContextMenuDownload( false);
116 } else if (itemId == R.id.contextmenu_save_link_as) { 120 } else if (itemId == R.id.contextmenu_save_link_as) {
117 if (mDelegate.startDownload(true)) helper.startContextMenuDownload(t rue); 121 if (mDelegate.startDownload(true)) helper.startContextMenuDownload(t rue);
118 } else if (itemId == R.id.contextmenu_search_by_image) { 122 } else if (itemId == R.id.contextmenu_search_by_image) {
119 mDelegate.onSearchByImageInNewTab(); 123 mDelegate.onSearchByImageInNewTab();
120 } else if (itemId == R.id.contextmenu_copy_image) { 124 } else if (itemId == R.id.contextmenu_copy_image) {
121 mDelegate.onSaveImageToClipboard(params.getSrcUrl()); 125 mDelegate.onSaveImageToClipboard(params.getSrcUrl());
126 } else if (itemId == R.id.contextmenu_copy_image_address) {
127 mDelegate.onSaveToClipboard(params.getSrcUrl(), true);
122 } else { 128 } else {
123 assert false; 129 assert false;
124 } 130 }
125 131
126 return true; 132 return true;
127 } 133 }
128 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698