| OLD | NEW |
| 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 "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h" | 5 #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" | |
| 8 #include "base/logging.h" | 7 #include "base/logging.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "ui/base/keycodes/keyboard_codes.h" |
| 11 #include "views/accelerator.h" | 11 #include "views/accelerator.h" |
| 12 #include "views/controls/menu/menu_2.h" | 12 #include "views/controls/menu/menu_2.h" |
| 13 | 13 |
| 14 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
| 15 // RenderViewContextMenuViews, public: | 15 // RenderViewContextMenuViews, public: |
| 16 | 16 |
| 17 RenderViewContextMenuViews::RenderViewContextMenuViews( | 17 RenderViewContextMenuViews::RenderViewContextMenuViews( |
| 18 TabContents* tab_contents, | 18 TabContents* tab_contents, |
| 19 const ContextMenuParams& params) | 19 const ContextMenuParams& params) |
| 20 : RenderViewContextMenu(tab_contents, params) { | 20 : RenderViewContextMenu(tab_contents, params) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #endif | 60 #endif |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool RenderViewContextMenuViews::GetAcceleratorForCommandId( | 63 bool RenderViewContextMenuViews::GetAcceleratorForCommandId( |
| 64 int command_id, | 64 int command_id, |
| 65 menus::Accelerator* accel) { | 65 menus::Accelerator* accel) { |
| 66 // There are no formally defined accelerators we can query so we assume | 66 // There are no formally defined accelerators we can query so we assume |
| 67 // that Ctrl+C, Ctrl+V, Ctrl+X, Ctrl-A, etc do what they normally do. | 67 // that Ctrl+C, Ctrl+V, Ctrl+X, Ctrl-A, etc do what they normally do. |
| 68 switch (command_id) { | 68 switch (command_id) { |
| 69 case IDC_CONTENT_CONTEXT_UNDO: | 69 case IDC_CONTENT_CONTEXT_UNDO: |
| 70 *accel = views::Accelerator(app::VKEY_Z, false, true, false); | 70 *accel = views::Accelerator(ui::VKEY_Z, false, true, false); |
| 71 return true; | 71 return true; |
| 72 | 72 |
| 73 case IDC_CONTENT_CONTEXT_REDO: | 73 case IDC_CONTENT_CONTEXT_REDO: |
| 74 // TODO(jcampan): should it be Ctrl-Y? | 74 // TODO(jcampan): should it be Ctrl-Y? |
| 75 *accel = views::Accelerator(app::VKEY_Z, true, true, false); | 75 *accel = views::Accelerator(ui::VKEY_Z, true, true, false); |
| 76 return true; | 76 return true; |
| 77 | 77 |
| 78 case IDC_CONTENT_CONTEXT_CUT: | 78 case IDC_CONTENT_CONTEXT_CUT: |
| 79 *accel = views::Accelerator(app::VKEY_X, false, true, false); | 79 *accel = views::Accelerator(ui::VKEY_X, false, true, false); |
| 80 return true; | 80 return true; |
| 81 | 81 |
| 82 case IDC_CONTENT_CONTEXT_COPY: | 82 case IDC_CONTENT_CONTEXT_COPY: |
| 83 *accel = views::Accelerator(app::VKEY_C, false, true, false); | 83 *accel = views::Accelerator(ui::VKEY_C, false, true, false); |
| 84 return true; | 84 return true; |
| 85 | 85 |
| 86 case IDC_CONTENT_CONTEXT_PASTE: | 86 case IDC_CONTENT_CONTEXT_PASTE: |
| 87 *accel = views::Accelerator(app::VKEY_V, false, true, false); | 87 *accel = views::Accelerator(ui::VKEY_V, false, true, false); |
| 88 return true; | 88 return true; |
| 89 | 89 |
| 90 case IDC_CONTENT_CONTEXT_SELECTALL: | 90 case IDC_CONTENT_CONTEXT_SELECTALL: |
| 91 *accel = views::Accelerator(app::VKEY_A, false, true, false); | 91 *accel = views::Accelerator(ui::VKEY_A, false, true, false); |
| 92 return true; | 92 return true; |
| 93 | 93 |
| 94 default: | 94 default: |
| 95 return false; | 95 return false; |
| 96 } | 96 } |
| 97 } | 97 } |
| OLD | NEW |