OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/views/renderer_context_menu/render_view_context_menu _views.h" | 5 #include "chrome/browser/ui/views/renderer_context_menu/render_view_context_menu _views.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 return true; | 70 return true; |
71 | 71 |
72 case IDC_CONTENT_CONTEXT_CUT: | 72 case IDC_CONTENT_CONTEXT_CUT: |
73 *accel = ui::Accelerator(ui::VKEY_X, ui::EF_CONTROL_DOWN); | 73 *accel = ui::Accelerator(ui::VKEY_X, ui::EF_CONTROL_DOWN); |
74 return true; | 74 return true; |
75 | 75 |
76 case IDC_CONTENT_CONTEXT_COPY: | 76 case IDC_CONTENT_CONTEXT_COPY: |
77 *accel = ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN); | 77 *accel = ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN); |
78 return true; | 78 return true; |
79 | 79 |
80 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: | |
81 *accel = | |
82 ui::Accelerator(ui::VKEY_I, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN); | |
msw
2014/11/11 07:27:09
nit: follow the surrounding line breaking conventi
Deepak
2014/11/11 07:35:47
Done.
| |
83 return true; | |
84 | |
80 case IDC_CONTENT_CONTEXT_PASTE: | 85 case IDC_CONTENT_CONTEXT_PASTE: |
81 *accel = ui::Accelerator(ui::VKEY_V, ui::EF_CONTROL_DOWN); | 86 *accel = ui::Accelerator(ui::VKEY_V, ui::EF_CONTROL_DOWN); |
82 return true; | 87 return true; |
83 | 88 |
84 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: | 89 case IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE: |
85 *accel = ui::Accelerator(ui::VKEY_V, | 90 *accel = ui::Accelerator(ui::VKEY_V, |
86 ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN); | 91 ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN); |
87 return true; | 92 return true; |
88 | 93 |
89 case IDC_CONTENT_CONTEXT_SELECTALL: | 94 case IDC_CONTENT_CONTEXT_SELECTALL: |
90 *accel = ui::Accelerator(ui::VKEY_A, ui::EF_CONTROL_DOWN); | 95 *accel = ui::Accelerator(ui::VKEY_A, ui::EF_CONTROL_DOWN); |
91 return true; | 96 return true; |
92 | 97 |
93 case IDC_CONTENT_CONTEXT_ROTATECCW: | 98 case IDC_CONTENT_CONTEXT_ROTATECCW: |
94 *accel = ui::Accelerator(ui::VKEY_OEM_4, ui::EF_CONTROL_DOWN); | 99 *accel = ui::Accelerator(ui::VKEY_OEM_4, ui::EF_CONTROL_DOWN); |
95 return true; | 100 return true; |
96 | 101 |
97 case IDC_CONTENT_CONTEXT_ROTATECW: | 102 case IDC_CONTENT_CONTEXT_ROTATECW: |
98 *accel = ui::Accelerator(ui::VKEY_OEM_6, ui::EF_CONTROL_DOWN); | 103 *accel = ui::Accelerator(ui::VKEY_OEM_6, ui::EF_CONTROL_DOWN); |
99 return true; | 104 return true; |
100 | 105 |
106 case IDC_PRINT: | |
107 *accel = ui::Accelerator(ui::VKEY_P, ui::EF_CONTROL_DOWN); | |
108 return true; | |
109 | |
101 default: | 110 default: |
102 return false; | 111 return false; |
103 } | 112 } |
104 } | 113 } |
105 | 114 |
106 void RenderViewContextMenuViews::ExecuteCommand(int command_id, | 115 void RenderViewContextMenuViews::ExecuteCommand(int command_id, |
107 int event_flags) { | 116 int event_flags) { |
108 switch (command_id) { | 117 switch (command_id) { |
109 case IDC_WRITING_DIRECTION_DEFAULT: | 118 case IDC_WRITING_DIRECTION_DEFAULT: |
110 // WebKit's current behavior is for this menu item to always be disabled. | 119 // WebKit's current behavior is for this menu item to always be disabled. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 WebContents::FromRenderFrameHost(GetRenderFrameHost()); | 226 WebContents::FromRenderFrameHost(GetRenderFrameHost()); |
218 if (!web_contents) { | 227 if (!web_contents) { |
219 LOG(ERROR) << "RenderViewContextMenuViews::Show, couldn't find WebContents"; | 228 LOG(ERROR) << "RenderViewContextMenuViews::Show, couldn't find WebContents"; |
220 return NULL; | 229 return NULL; |
221 } | 230 } |
222 return web_contents->GetFullscreenRenderWidgetHostView() | 231 return web_contents->GetFullscreenRenderWidgetHostView() |
223 ? web_contents->GetFullscreenRenderWidgetHostView() | 232 ? web_contents->GetFullscreenRenderWidgetHostView() |
224 ->GetNativeView() | 233 ->GetNativeView() |
225 : web_contents->GetNativeView(); | 234 : web_contents->GetNativeView(); |
226 } | 235 } |
OLD | NEW |