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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 //////////////////////////////////////////////////////////////////////////////// | 53 //////////////////////////////////////////////////////////////////////////////// |
54 // RenderViewContextMenuViews, protected: | 54 // RenderViewContextMenuViews, protected: |
55 | 55 |
56 bool RenderViewContextMenuViews::GetAcceleratorForCommandId( | 56 bool RenderViewContextMenuViews::GetAcceleratorForCommandId( |
57 int command_id, | 57 int command_id, |
58 ui::Accelerator* accel) { | 58 ui::Accelerator* accel) { |
59 // There are no formally defined accelerators we can query so we assume | 59 // There are no formally defined accelerators we can query so we assume |
60 // that Ctrl+C, Ctrl+V, Ctrl+X, Ctrl-A, etc do what they normally do. | 60 // that Ctrl+C, Ctrl+V, Ctrl+X, Ctrl-A, etc do what they normally do. |
61 switch (command_id) { | 61 switch (command_id) { |
| 62 case IDC_BACK: |
| 63 *accel = ui::Accelerator(ui::VKEY_LEFT, ui::EF_ALT_DOWN); |
| 64 return true; |
| 65 |
62 case IDC_CONTENT_CONTEXT_UNDO: | 66 case IDC_CONTENT_CONTEXT_UNDO: |
63 *accel = ui::Accelerator(ui::VKEY_Z, ui::EF_CONTROL_DOWN); | 67 *accel = ui::Accelerator(ui::VKEY_Z, ui::EF_CONTROL_DOWN); |
64 return true; | 68 return true; |
65 | 69 |
66 case IDC_CONTENT_CONTEXT_REDO: | 70 case IDC_CONTENT_CONTEXT_REDO: |
67 // TODO(jcampan): should it be Ctrl-Y? | 71 // TODO(jcampan): should it be Ctrl-Y? |
68 *accel = ui::Accelerator(ui::VKEY_Z, | 72 *accel = ui::Accelerator(ui::VKEY_Z, |
69 ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN); | 73 ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN); |
70 return true; | 74 return true; |
71 | 75 |
(...skipping 24 matching lines...) Expand all Loading... |
96 return true; | 100 return true; |
97 | 101 |
98 case IDC_CONTENT_CONTEXT_ROTATECCW: | 102 case IDC_CONTENT_CONTEXT_ROTATECCW: |
99 *accel = ui::Accelerator(ui::VKEY_OEM_4, ui::EF_CONTROL_DOWN); | 103 *accel = ui::Accelerator(ui::VKEY_OEM_4, ui::EF_CONTROL_DOWN); |
100 return true; | 104 return true; |
101 | 105 |
102 case IDC_CONTENT_CONTEXT_ROTATECW: | 106 case IDC_CONTENT_CONTEXT_ROTATECW: |
103 *accel = ui::Accelerator(ui::VKEY_OEM_6, ui::EF_CONTROL_DOWN); | 107 *accel = ui::Accelerator(ui::VKEY_OEM_6, ui::EF_CONTROL_DOWN); |
104 return true; | 108 return true; |
105 | 109 |
| 110 case IDC_FORWARD: |
| 111 *accel = ui::Accelerator(ui::VKEY_RIGHT, ui::EF_ALT_DOWN); |
| 112 return true; |
| 113 |
106 case IDC_PRINT: | 114 case IDC_PRINT: |
107 *accel = ui::Accelerator(ui::VKEY_P, ui::EF_CONTROL_DOWN); | 115 *accel = ui::Accelerator(ui::VKEY_P, ui::EF_CONTROL_DOWN); |
108 return true; | 116 return true; |
109 | 117 |
110 case IDC_RELOAD: | 118 case IDC_RELOAD: |
111 *accel = ui::Accelerator(ui::VKEY_R, ui::EF_CONTROL_DOWN); | 119 *accel = ui::Accelerator(ui::VKEY_R, ui::EF_CONTROL_DOWN); |
112 return true; | 120 return true; |
113 | 121 |
| 122 case IDC_SAVE_PAGE: |
| 123 *accel = ui::Accelerator(ui::VKEY_S, ui::EF_CONTROL_DOWN); |
| 124 return true; |
| 125 |
114 case IDC_VIEW_SOURCE: | 126 case IDC_VIEW_SOURCE: |
115 *accel = ui::Accelerator(ui::VKEY_U, ui::EF_CONTROL_DOWN); | 127 *accel = ui::Accelerator(ui::VKEY_U, ui::EF_CONTROL_DOWN); |
116 return true; | 128 return true; |
117 | 129 |
118 default: | 130 default: |
119 return false; | 131 return false; |
120 } | 132 } |
121 } | 133 } |
122 | 134 |
123 void RenderViewContextMenuViews::ExecuteCommand(int command_id, | 135 void RenderViewContextMenuViews::ExecuteCommand(int command_id, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 WebContents::FromRenderFrameHost(GetRenderFrameHost()); | 246 WebContents::FromRenderFrameHost(GetRenderFrameHost()); |
235 if (!web_contents) { | 247 if (!web_contents) { |
236 LOG(ERROR) << "RenderViewContextMenuViews::Show, couldn't find WebContents"; | 248 LOG(ERROR) << "RenderViewContextMenuViews::Show, couldn't find WebContents"; |
237 return NULL; | 249 return NULL; |
238 } | 250 } |
239 return web_contents->GetFullscreenRenderWidgetHostView() | 251 return web_contents->GetFullscreenRenderWidgetHostView() |
240 ? web_contents->GetFullscreenRenderWidgetHostView() | 252 ? web_contents->GetFullscreenRenderWidgetHostView() |
241 ->GetNativeView() | 253 ->GetNativeView() |
242 : web_contents->GetNativeView(); | 254 : web_contents->GetNativeView(); |
243 } | 255 } |
OLD | NEW |