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

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 21323003: The UI part of search-by-image search. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: address jam's comment Created 7 years, 4 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 | Annotate | Revision Log
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 #include "chrome/browser/tab_contents/render_view_context_menu.h" 5 #include "chrome/browser/tab_contents/render_view_context_menu.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
11 #include "apps/app_load_service.h" 11 #include "apps/app_load_service.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/prefs/pref_member.h" 15 #include "base/prefs/pref_member.h"
16 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
17 #include "base/stl_util.h" 17 #include "base/stl_util.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h"
19 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
20 #include "base/time/time.h" 21 #include "base/time/time.h"
21 #include "chrome/app/chrome_command_ids.h" 22 #include "chrome/app/chrome_command_ids.h"
22 #include "chrome/browser/app_mode/app_mode_utils.h" 23 #include "chrome/browser/app_mode/app_mode_utils.h"
23 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 24 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
24 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 25 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
25 #include "chrome/browser/autocomplete/autocomplete_match.h" 26 #include "chrome/browser/autocomplete/autocomplete_match.h"
26 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
27 #include "chrome/browser/chrome_notification_types.h" 28 #include "chrome/browser/chrome_notification_types.h"
28 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 29 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
29 #include "chrome/browser/devtools/devtools_window.h" 30 #include "chrome/browser/devtools/devtools_window.h"
30 #include "chrome/browser/download/download_service.h" 31 #include "chrome/browser/download/download_service.h"
31 #include "chrome/browser/download/download_service_factory.h" 32 #include "chrome/browser/download/download_service_factory.h"
32 #include "chrome/browser/download/download_util.h" 33 #include "chrome/browser/download/download_util.h"
33 #include "chrome/browser/extensions/extension_host.h" 34 #include "chrome/browser/extensions/extension_host.h"
34 #include "chrome/browser/extensions/extension_service.h" 35 #include "chrome/browser/extensions/extension_service.h"
35 #include "chrome/browser/extensions/extension_system.h" 36 #include "chrome/browser/extensions/extension_system.h"
36 #include "chrome/browser/google/google_util.h" 37 #include "chrome/browser/google/google_util.h"
37 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" 38 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
38 #include "chrome/browser/prefs/incognito_mode_prefs.h" 39 #include "chrome/browser/prefs/incognito_mode_prefs.h"
39 #include "chrome/browser/printing/print_preview_context_menu_observer.h" 40 #include "chrome/browser/printing/print_preview_context_menu_observer.h"
40 #include "chrome/browser/printing/print_preview_dialog_controller.h" 41 #include "chrome/browser/printing/print_preview_dialog_controller.h"
41 #include "chrome/browser/printing/print_view_manager.h" 42 #include "chrome/browser/printing/print_view_manager.h"
42 #include "chrome/browser/profiles/profile.h" 43 #include "chrome/browser/profiles/profile.h"
43 #include "chrome/browser/profiles/profile_io_data.h" 44 #include "chrome/browser/profiles/profile_io_data.h"
44 #include "chrome/browser/search/search.h" 45 #include "chrome/browser/search/search.h"
46 #include "chrome/browser/search_engines/search_terms_data.h"
45 #include "chrome/browser/search_engines/template_url.h" 47 #include "chrome/browser/search_engines/template_url.h"
46 #include "chrome/browser/search_engines/template_url_service.h" 48 #include "chrome/browser/search_engines/template_url_service.h"
47 #include "chrome/browser/search_engines/template_url_service_factory.h" 49 #include "chrome/browser/search_engines/template_url_service_factory.h"
48 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" 50 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
49 #include "chrome/browser/spellchecker/spellcheck_service.h" 51 #include "chrome/browser/spellchecker/spellcheck_service.h"
50 #include "chrome/browser/tab_contents/retargeting_details.h" 52 #include "chrome/browser/tab_contents/retargeting_details.h"
51 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" 53 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h"
52 #include "chrome/browser/tab_contents/spelling_menu_observer.h" 54 #include "chrome/browser/tab_contents/spelling_menu_observer.h"
53 #include "chrome/browser/translate/translate_manager.h" 55 #include "chrome/browser/translate/translate_manager.h"
54 #include "chrome/browser/translate/translate_prefs.h" 56 #include "chrome/browser/translate/translate_prefs.h"
55 #include "chrome/browser/translate/translate_tab_helper.h" 57 #include "chrome/browser/translate/translate_tab_helper.h"
56 #include "chrome/browser/ui/browser.h" 58 #include "chrome/browser/ui/browser.h"
57 #include "chrome/browser/ui/browser_commands.h" 59 #include "chrome/browser/ui/browser_commands.h"
58 #include "chrome/browser/ui/browser_finder.h" 60 #include "chrome/browser/ui/browser_finder.h"
59 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" 61 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
60 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 62 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
61 #include "chrome/common/chrome_constants.h" 63 #include "chrome/common/chrome_constants.h"
62 #include "chrome/common/chrome_switches.h" 64 #include "chrome/common/chrome_switches.h"
63 #include "chrome/common/content_restriction.h" 65 #include "chrome/common/content_restriction.h"
64 #include "chrome/common/extensions/extension.h" 66 #include "chrome/common/extensions/extension.h"
65 #include "chrome/common/net/url_util.h" 67 #include "chrome/common/net/url_util.h"
66 #include "chrome/common/pref_names.h" 68 #include "chrome/common/pref_names.h"
67 #include "chrome/common/print_messages.h" 69 #include "chrome/common/print_messages.h"
70 #include "chrome/common/render_messages.h"
68 #include "chrome/common/spellcheck_messages.h" 71 #include "chrome/common/spellcheck_messages.h"
69 #include "chrome/common/url_constants.h" 72 #include "chrome/common/url_constants.h"
70 #include "content/public/browser/child_process_security_policy.h" 73 #include "content/public/browser/child_process_security_policy.h"
71 #include "content/public/browser/download_manager.h" 74 #include "content/public/browser/download_manager.h"
72 #include "content/public/browser/download_save_info.h" 75 #include "content/public/browser/download_save_info.h"
73 #include "content/public/browser/download_url_parameters.h" 76 #include "content/public/browser/download_url_parameters.h"
74 #include "content/public/browser/navigation_details.h" 77 #include "content/public/browser/navigation_details.h"
75 #include "content/public/browser/navigation_entry.h" 78 #include "content/public/browser/navigation_entry.h"
76 #include "content/public/browser/notification_service.h" 79 #include "content/public/browser/notification_service.h"
77 #include "content/public/browser/render_process_host.h" 80 #include "content/public/browser/render_process_host.h"
78 #include "content/public/browser/render_view_host.h" 81 #include "content/public/browser/render_view_host.h"
79 #include "content/public/browser/render_widget_host_view.h" 82 #include "content/public/browser/render_widget_host_view.h"
80 #include "content/public/browser/user_metrics.h" 83 #include "content/public/browser/user_metrics.h"
81 #include "content/public/browser/web_contents.h" 84 #include "content/public/browser/web_contents.h"
82 #include "content/public/common/menu_item.h" 85 #include "content/public/common/menu_item.h"
83 #include "content/public/common/ssl_status.h" 86 #include "content/public/common/ssl_status.h"
84 #include "content/public/common/url_utils.h" 87 #include "content/public/common/url_utils.h"
85 #include "extensions/browser/view_type_utils.h" 88 #include "extensions/browser/view_type_utils.h"
86 #include "grit/generated_resources.h" 89 #include "grit/generated_resources.h"
87 #include "net/base/escape.h" 90 #include "net/base/escape.h"
88 #include "third_party/WebKit/public/web/WebContextMenuData.h" 91 #include "third_party/WebKit/public/web/WebContextMenuData.h"
89 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" 92 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h"
90 #include "third_party/WebKit/public/web/WebPluginAction.h" 93 #include "third_party/WebKit/public/web/WebPluginAction.h"
91 #include "ui/base/clipboard/clipboard.h" 94 #include "ui/base/clipboard/clipboard.h"
92 #include "ui/base/l10n/l10n_util.h" 95 #include "ui/base/l10n/l10n_util.h"
93 #include "ui/base/text/text_elider.h" 96 #include "ui/base/text/text_elider.h"
94 #include "ui/gfx/favicon_size.h" 97 #include "ui/gfx/favicon_size.h"
98 #include "ui/gfx/point.h"
99 #include "ui/gfx/size.h"
95 100
96 using WebKit::WebContextMenuData; 101 using WebKit::WebContextMenuData;
97 using WebKit::WebMediaPlayerAction; 102 using WebKit::WebMediaPlayerAction;
98 using WebKit::WebPluginAction; 103 using WebKit::WebPluginAction;
99 using WebKit::WebString; 104 using WebKit::WebString;
100 using WebKit::WebURL; 105 using WebKit::WebURL;
101 using content::BrowserContext; 106 using content::BrowserContext;
102 using content::ChildProcessSecurityPolicy; 107 using content::ChildProcessSecurityPolicy;
103 using content::DownloadManager; 108 using content::DownloadManager;
104 using content::DownloadUrlParameters; 109 using content::DownloadUrlParameters;
105 using content::NavigationController; 110 using content::NavigationController;
106 using content::NavigationEntry; 111 using content::NavigationEntry;
107 using content::OpenURLParams; 112 using content::OpenURLParams;
108 using content::RenderViewHost; 113 using content::RenderViewHost;
109 using content::SSLStatus; 114 using content::SSLStatus;
110 using content::UserMetricsAction; 115 using content::UserMetricsAction;
111 using content::WebContents; 116 using content::WebContents;
112 using extensions::Extension; 117 using extensions::Extension;
113 using extensions::MenuItem; 118 using extensions::MenuItem;
114 using extensions::MenuManager; 119 using extensions::MenuManager;
115 120
116 namespace { 121 namespace {
117 122
123 const int kImageSearchThumbnailMinSize = 300 * 300;
124 const int kImageSearchThumbnailMaxWidth = 600;
125 const int kImageSearchThumbnailMaxHeight = 600;
126
118 // Maps UMA enumeration to IDC. IDC could be changed so we can't use 127 // Maps UMA enumeration to IDC. IDC could be changed so we can't use
119 // just them and |UMA_HISTOGRAM_CUSTOM_ENUMERATION|. 128 // just them and |UMA_HISTOGRAM_CUSTOM_ENUMERATION|.
120 // Never change mapping or reuse |enum_id|. Always push back new items. 129 // Never change mapping or reuse |enum_id|. Always push back new items.
121 // Items that is not used any more by |RenderViewContextMenu.ExecuteCommand| 130 // Items that is not used any more by |RenderViewContextMenu.ExecuteCommand|
122 // could be deleted, but don't change the rest of |kUmaEnumToControlId|. 131 // could be deleted, but don't change the rest of |kUmaEnumToControlId|.
123 const struct UmaEnumCommandIdPair { 132 const struct UmaEnumCommandIdPair {
124 int enum_id; 133 int enum_id;
125 int control_id; 134 int control_id;
126 } kUmaEnumToControlId[] = { 135 } kUmaEnumToControlId[] = {
127 { 0, IDC_CONTENT_CONTEXT_CUSTOM_FIRST }, 136 { 0, IDC_CONTENT_CONTEXT_CUSTOM_FIRST },
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 { 47, IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS }, 183 { 47, IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS },
175 { 48, IDC_CONTENT_CONTEXT_ADDSEARCHENGINE }, 184 { 48, IDC_CONTENT_CONTEXT_ADDSEARCHENGINE },
176 { 49, IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES }, 185 { 49, IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES },
177 { 50, IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT }, 186 { 50, IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT },
178 { 51, IDC_SPEECH_INPUT_MENU }, 187 { 51, IDC_SPEECH_INPUT_MENU },
179 { 52, IDC_CONTENT_CONTEXT_OPENLINKWITH }, 188 { 52, IDC_CONTENT_CONTEXT_OPENLINKWITH },
180 { 53, IDC_CHECK_SPELLING_WHILE_TYPING }, 189 { 53, IDC_CHECK_SPELLING_WHILE_TYPING },
181 { 54, IDC_SPELLCHECK_MENU }, 190 { 54, IDC_SPELLCHECK_MENU },
182 { 55, IDC_CONTENT_CONTEXT_SPELLING_TOGGLE }, 191 { 55, IDC_CONTENT_CONTEXT_SPELLING_TOGGLE },
183 { 56, IDC_SPELLCHECK_LANGUAGES_FIRST }, 192 { 56, IDC_SPELLCHECK_LANGUAGES_FIRST },
193 { 57, IDC_CONTENT_CONTEXT_SEARCHIMAGENEWTAB },
184 // Add new items here and use |enum_id| from the next line. 194 // Add new items here and use |enum_id| from the next line.
185 { 57, 0 }, // Must be the last. Increment |enum_id| when new IDC was added. 195 { 58, 0 }, // Must be the last. Increment |enum_id| when new IDC was added.
186 }; 196 };
187 197
188 // Collapses large ranges of ids before looking for UMA enum. 198 // Collapses large ranges of ids before looking for UMA enum.
189 int CollapleCommandsForUMA(int id) { 199 int CollapleCommandsForUMA(int id) {
190 if (id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST && 200 if (id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST &&
191 id <= IDC_CONTENT_CONTEXT_CUSTOM_LAST) { 201 id <= IDC_CONTENT_CONTEXT_CUSTOM_LAST) {
192 return IDC_CONTENT_CONTEXT_CUSTOM_FIRST; 202 return IDC_CONTENT_CONTEXT_CUSTOM_FIRST;
193 } 203 }
194 204
195 if (id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST && 205 if (id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST &&
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 void RenderViewContextMenu::AppendImageItems() { 846 void RenderViewContextMenu::AppendImageItems() {
837 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEIMAGEAS, 847 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEIMAGEAS,
838 IDS_CONTENT_CONTEXT_SAVEIMAGEAS); 848 IDS_CONTENT_CONTEXT_SAVEIMAGEAS);
839 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGELOCATION, 849 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGELOCATION,
840 IDS_CONTENT_CONTEXT_COPYIMAGELOCATION); 850 IDS_CONTENT_CONTEXT_COPYIMAGELOCATION);
841 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGE, 851 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGE,
842 IDS_CONTENT_CONTEXT_COPYIMAGE); 852 IDS_CONTENT_CONTEXT_COPYIMAGE);
843 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB, 853 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB,
844 IDS_CONTENT_CONTEXT_OPENIMAGENEWTAB); 854 IDS_CONTENT_CONTEXT_OPENIMAGENEWTAB);
845 AppendPrintItem(); 855 AppendPrintItem();
856 const TemplateURL* const default_provider =
857 TemplateURLServiceFactory::GetForProfile(profile_)->
858 GetDefaultSearchProvider();
859 if (!default_provider)
860 return;
861 SearchTermsData search_terms;
862 if (!default_provider->image_url().empty() &&
863 default_provider->image_url_ref().IsValidUsingTermsData(search_terms)) {
864 menu_model_.AddItem(
865 IDC_CONTENT_CONTEXT_SEARCHIMAGENEWTAB,
866 l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_SEARCHWEBFORIMAGE,
867 default_provider->short_name()));
868 }
846 } 869 }
847 870
848 void RenderViewContextMenu::AppendAudioItems() { 871 void RenderViewContextMenu::AppendAudioItems() {
849 AppendMediaItems(); 872 AppendMediaItems();
850 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); 873 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
851 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS, 874 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS,
852 IDS_CONTENT_CONTEXT_SAVEAUDIOAS); 875 IDS_CONTENT_CONTEXT_SAVEAUDIOAS);
853 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYAVLOCATION, 876 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYAVLOCATION,
854 IDS_CONTENT_CONTEXT_COPYAUDIOLOCATION); 877 IDS_CONTENT_CONTEXT_COPYAUDIOLOCATION);
855 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENAVNEWTAB, 878 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENAVNEWTAB,
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 DCHECK(local_state); 1269 DCHECK(local_state);
1247 // Test if file-selection dialogs are forbidden by policy. 1270 // Test if file-selection dialogs are forbidden by policy.
1248 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) 1271 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs))
1249 return false; 1272 return false;
1250 1273
1251 return params_.src_url.is_valid() && 1274 return params_.src_url.is_valid() &&
1252 ProfileIOData::IsHandledProtocol(params_.src_url.scheme()); 1275 ProfileIOData::IsHandledProtocol(params_.src_url.scheme());
1253 } 1276 }
1254 1277
1255 case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB: 1278 case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB:
1279 case IDC_CONTENT_CONTEXT_SEARCHIMAGENEWTAB:
1256 // The images shown in the most visited thumbnails do not currently open 1280 // The images shown in the most visited thumbnails do not currently open
1257 // in a new tab as they should. Disabling this context menu option for 1281 // in a new tab as they should. Disabling this context menu option for
1258 // now, as a quick hack, before we resolve this issue (Issue = 2608). 1282 // now, as a quick hack, before we resolve this issue (Issue = 2608).
1259 // TODO(sidchat): Enable this option once this issue is resolved. 1283 // TODO(sidchat): Enable this option once this issue is resolved.
1260 if (params_.src_url.scheme() == chrome::kChromeUIScheme || 1284 if (params_.src_url.scheme() == chrome::kChromeUIScheme ||
1261 !params_.src_url.is_valid()) 1285 !params_.src_url.is_valid())
1262 return false; 1286 return false;
1263 return true; 1287 return true;
1264 1288
1265 case IDC_CONTENT_CONTEXT_COPYIMAGE: 1289 case IDC_CONTENT_CONTEXT_COPYIMAGE:
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 1623
1600 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: 1624 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION:
1601 case IDC_CONTENT_CONTEXT_COPYAVLOCATION: 1625 case IDC_CONTENT_CONTEXT_COPYAVLOCATION:
1602 WriteURLToClipboard(params_.src_url); 1626 WriteURLToClipboard(params_.src_url);
1603 break; 1627 break;
1604 1628
1605 case IDC_CONTENT_CONTEXT_COPYIMAGE: 1629 case IDC_CONTENT_CONTEXT_COPYIMAGE:
1606 CopyImageAt(params_.x, params_.y); 1630 CopyImageAt(params_.x, params_.y);
1607 break; 1631 break;
1608 1632
1633 case IDC_CONTENT_CONTEXT_SEARCHIMAGENEWTAB:
1634 GetImageThumbnailForSearch();
1635 break;
1636
1609 case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB: 1637 case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB:
1610 case IDC_CONTENT_CONTEXT_OPENAVNEWTAB: 1638 case IDC_CONTENT_CONTEXT_OPENAVNEWTAB:
1611 OpenURL( 1639 OpenURL(
1612 params_.src_url, 1640 params_.src_url,
1613 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url, 1641 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url,
1614 params_.frame_id, 1642 params_.frame_id,
1615 NEW_BACKGROUND_TAB, content::PAGE_TRANSITION_LINK); 1643 NEW_BACKGROUND_TAB, content::PAGE_TRANSITION_LINK);
1616 break; 1644 break;
1617 1645
1618 case IDC_CONTENT_CONTEXT_PLAYPAUSE: { 1646 case IDC_CONTENT_CONTEXT_PLAYPAUSE: {
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 chrome::NOTIFICATION_RETARGETING, 2055 chrome::NOTIFICATION_RETARGETING,
2028 content::Source<Profile>(Profile::FromBrowserContext( 2056 content::Source<Profile>(Profile::FromBrowserContext(
2029 source_web_contents_->GetBrowserContext())), 2057 source_web_contents_->GetBrowserContext())),
2030 content::Details<RetargetingDetails>(&details)); 2058 content::Details<RetargetingDetails>(&details));
2031 } 2059 }
2032 2060
2033 void RenderViewContextMenu::CopyImageAt(int x, int y) { 2061 void RenderViewContextMenu::CopyImageAt(int x, int y) {
2034 source_web_contents_->GetRenderViewHost()->CopyImageAt(x, y); 2062 source_web_contents_->GetRenderViewHost()->CopyImageAt(x, y);
2035 } 2063 }
2036 2064
2065 void RenderViewContextMenu::GetImageThumbnailForSearch() {
2066 source_web_contents_->GetRenderViewHost()->Send(
2067 new ChromeViewMsg_RequestThumbnailForContextNode(
2068 source_web_contents_->GetRenderViewHost()->GetRoutingID(),
2069 kImageSearchThumbnailMinSize,
2070 gfx::Size(kImageSearchThumbnailMaxWidth,
2071 kImageSearchThumbnailMaxHeight)));
2072 }
2073
2037 void RenderViewContextMenu::Inspect(int x, int y) { 2074 void RenderViewContextMenu::Inspect(int x, int y) {
2038 content::RecordAction(UserMetricsAction("DevTools_InspectElement")); 2075 content::RecordAction(UserMetricsAction("DevTools_InspectElement"));
2039 source_web_contents_->GetRenderViewHostAtPosition( 2076 source_web_contents_->GetRenderViewHostAtPosition(
2040 x, y, base::Bind(&DevToolsInspectElementAt)); 2077 x, y, base::Bind(&DevToolsInspectElementAt));
2041 } 2078 }
2042 2079
2043 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { 2080 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) {
2044 chrome_common_net::WriteURLToClipboard( 2081 chrome_common_net::WriteURLToClipboard(
2045 url, 2082 url,
2046 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), 2083 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
2047 ui::Clipboard::GetForCurrentThread()); 2084 ui::Clipboard::GetForCurrentThread());
2048 } 2085 }
2049 2086
2050 void RenderViewContextMenu::MediaPlayerActionAt( 2087 void RenderViewContextMenu::MediaPlayerActionAt(
2051 const gfx::Point& location, 2088 const gfx::Point& location,
2052 const WebMediaPlayerAction& action) { 2089 const WebMediaPlayerAction& action) {
2053 source_web_contents_->GetRenderViewHost()-> 2090 source_web_contents_->GetRenderViewHost()->
2054 ExecuteMediaPlayerActionAtLocation(location, action); 2091 ExecuteMediaPlayerActionAtLocation(location, action);
2055 } 2092 }
2056 2093
2057 void RenderViewContextMenu::PluginActionAt( 2094 void RenderViewContextMenu::PluginActionAt(
2058 const gfx::Point& location, 2095 const gfx::Point& location,
2059 const WebPluginAction& action) { 2096 const WebPluginAction& action) {
2060 source_web_contents_->GetRenderViewHost()-> 2097 source_web_contents_->GetRenderViewHost()->
2061 ExecutePluginActionAtLocation(location, action); 2098 ExecutePluginActionAtLocation(location, action);
2062 } 2099 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | chrome/browser/ui/gtk/menu_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698