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

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

Issue 6893046: added CTRL+Click and SHIFT+Click handler for context menu, Back and Forward. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: make this patch applicable to the latest trunk Created 9 years, 6 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
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 7
8 #include "chrome/browser/tab_contents/render_view_context_menu.h" 8 #include "chrome/browser/tab_contents/render_view_context_menu.h"
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/stl_util-inl.h" 13 #include "base/stl_util-inl.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/app/chrome_command_ids.h" 17 #include "chrome/app/chrome_command_ids.h"
18 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 18 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
19 #include "chrome/browser/autocomplete/autocomplete_edit.h" 19 #include "chrome/browser/autocomplete/autocomplete_edit.h"
20 #include "chrome/browser/autocomplete/autocomplete_match.h" 20 #include "chrome/browser/autocomplete/autocomplete_match.h"
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/debugger/devtools_manager.h" 22 #include "chrome/browser/debugger/devtools_manager.h"
23 #include "chrome/browser/debugger/devtools_window.h" 23 #include "chrome/browser/debugger/devtools_window.h"
24 #include "chrome/browser/download/download_manager.h" 24 #include "chrome/browser/download/download_manager.h"
25 #include "chrome/browser/download/download_util.h" 25 #include "chrome/browser/download/download_util.h"
26 #include "chrome/browser/download/save_package.h" 26 #include "chrome/browser/download/save_package.h"
27 #include "chrome/browser/event_disposition.h"
27 #include "chrome/browser/extensions/extension_event_router.h" 28 #include "chrome/browser/extensions/extension_event_router.h"
28 #include "chrome/browser/extensions/extension_service.h" 29 #include "chrome/browser/extensions/extension_service.h"
29 #include "chrome/browser/net/browser_url_util.h" 30 #include "chrome/browser/net/browser_url_util.h"
30 #include "chrome/browser/page_info_window.h" 31 #include "chrome/browser/page_info_window.h"
31 #include "chrome/browser/platform_util.h" 32 #include "chrome/browser/platform_util.h"
32 #include "chrome/browser/prefs/pref_member.h" 33 #include "chrome/browser/prefs/pref_member.h"
33 #include "chrome/browser/prefs/pref_service.h" 34 #include "chrome/browser/prefs/pref_service.h"
34 #include "chrome/browser/profiles/profile.h" 35 #include "chrome/browser/profiles/profile.h"
35 #include "chrome/browser/profiles/profile_io_data.h" 36 #include "chrome/browser/profiles/profile_io_data.h"
36 #include "chrome/browser/search_engines/template_url.h" 37 #include "chrome/browser/search_engines/template_url.h"
(...skipping 20 matching lines...) Expand all
57 #include "content/browser/user_metrics.h" 58 #include "content/browser/user_metrics.h"
58 #include "content/common/content_restriction.h" 59 #include "content/common/content_restriction.h"
59 #include "content/common/view_messages.h" 60 #include "content/common/view_messages.h"
60 #include "grit/generated_resources.h" 61 #include "grit/generated_resources.h"
61 #include "net/base/escape.h" 62 #include "net/base/escape.h"
62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" 63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction. h" 64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction. h"
64 #include "ui/base/l10n/l10n_util.h" 65 #include "ui/base/l10n/l10n_util.h"
65 #include "ui/gfx/favicon_size.h" 66 #include "ui/gfx/favicon_size.h"
66 #include "webkit/glue/webmenuitem.h" 67 #include "webkit/glue/webmenuitem.h"
68 #include "webkit/glue/window_open_disposition.h"
67 69
68 using WebKit::WebContextMenuData; 70 using WebKit::WebContextMenuData;
69 using WebKit::WebMediaPlayerAction; 71 using WebKit::WebMediaPlayerAction;
70 using WebKit::WebURL; 72 using WebKit::WebURL;
71 using WebKit::WebString; 73 using WebKit::WebString;
72 74
73 namespace { 75 namespace {
74 76
75 bool IsCustomItemEnabled(const std::vector<WebMenuItem>& items, int id) { 77 bool IsCustomItemEnabled(const std::vector<WebMenuItem>& items, int id) {
76 DCHECK(id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST && 78 DCHECK(id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST &&
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 // language. 1202 // language.
1201 if ((id < IDC_SPELLCHECK_LANGUAGES_FIRST) || 1203 if ((id < IDC_SPELLCHECK_LANGUAGES_FIRST) ||
1202 (id >= IDC_SPELLCHECK_LANGUAGES_LAST)) 1204 (id >= IDC_SPELLCHECK_LANGUAGES_LAST))
1203 return false; 1205 return false;
1204 1206
1205 std::vector<std::string> languages; 1207 std::vector<std::string> languages;
1206 return SpellCheckHost::GetSpellCheckLanguages(profile_, &languages) == 1208 return SpellCheckHost::GetSpellCheckLanguages(profile_, &languages) ==
1207 (id - IDC_SPELLCHECK_LANGUAGES_FIRST); 1209 (id - IDC_SPELLCHECK_LANGUAGES_FIRST);
1208 } 1210 }
1209 1211
1212 void RenderViewContextMenu::ExecuteCommandWithFlags(int id, int event_flags) {
1213 if (source_tab_contents_->delegate() &&
1214 source_tab_contents_->delegate()->ExecuteContextMenuCommand(
1215 id, event_flags))
1216 return;
1217
1218 ExecuteCommand(id);
1219 }
1220
1210 void RenderViewContextMenu::ExecuteCommand(int id) { 1221 void RenderViewContextMenu::ExecuteCommand(int id) {
1211 // Check to see if one of the spell check language ids have been clicked. 1222 // Check to see if one of the spell check language ids have been clicked.
1212 if (id >= IDC_SPELLCHECK_LANGUAGES_FIRST && 1223 if (id >= IDC_SPELLCHECK_LANGUAGES_FIRST &&
1213 id < IDC_SPELLCHECK_LANGUAGES_LAST) { 1224 id < IDC_SPELLCHECK_LANGUAGES_LAST) {
1214 const size_t language_number = id - IDC_SPELLCHECK_LANGUAGES_FIRST; 1225 const size_t language_number = id - IDC_SPELLCHECK_LANGUAGES_FIRST;
1215 std::vector<std::string> languages; 1226 std::vector<std::string> languages;
1216 SpellCheckHost::GetSpellCheckLanguages(profile_, &languages); 1227 SpellCheckHost::GetSpellCheckLanguages(profile_, &languages);
1217 if (language_number < languages.size()) { 1228 if (language_number < languages.size()) {
1218 StringPrefMember dictionary_language; 1229 StringPrefMember dictionary_language;
1219 dictionary_language.Init(prefs::kSpellCheckDictionary, 1230 dictionary_language.Init(prefs::kSpellCheckDictionary,
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 g_browser_process->clipboard()); 1649 g_browser_process->clipboard());
1639 } 1650 }
1640 1651
1641 void RenderViewContextMenu::MediaPlayerActionAt( 1652 void RenderViewContextMenu::MediaPlayerActionAt(
1642 const gfx::Point& location, 1653 const gfx::Point& location,
1643 const WebMediaPlayerAction& action) { 1654 const WebMediaPlayerAction& action) {
1644 RenderViewHost* rvh = source_tab_contents_->render_view_host(); 1655 RenderViewHost* rvh = source_tab_contents_->render_view_host();
1645 rvh->Send(new ViewMsg_MediaPlayerActionAt( 1656 rvh->Send(new ViewMsg_MediaPlayerActionAt(
1646 rvh->routing_id(), location, action)); 1657 rvh->routing_id(), location, action));
1647 } 1658 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698