| Index: chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| index 5d354645004021fc2cecd6e80130d528a8f4b8e6..58805de15c08be50661b775ef67a927e8fa70ec5 100644
|
| --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| @@ -49,6 +49,7 @@
|
| #include "ui/base/models/simple_menu_model.h"
|
| #include "ui/compositor/layer.h"
|
| #include "ui/events/event.h"
|
| +#include "ui/events/text_edit_commands.h"
|
| #include "ui/gfx/canvas.h"
|
| #include "ui/gfx/font_list.h"
|
| #include "ui/gfx/selection_model.h"
|
| @@ -369,7 +370,7 @@ void OmniboxViewViews::ExecuteCommand(int command_id, int event_flags) {
|
|
|
| // These commands do invoke the popup.
|
| case IDS_APP_PASTE:
|
| - ExecuteEditCommand(IDS_APP_PASTE);
|
| + ExecuteEditCommand(ui::TextEditCommand::PASTE);
|
| return;
|
| default:
|
| if (Textfield::IsCommandIdEnabled(command_id)) {
|
| @@ -754,14 +755,14 @@ bool OmniboxViewViews::OnKeyPressed(const ui::KeyEvent& event) {
|
| model()->popup_model()->TryDeletingCurrentItem();
|
| break;
|
| case ui::VKEY_UP:
|
| - if (IsEditCommandEnabled(IDS_MOVE_UP)) {
|
| - ExecuteEditCommand(IDS_MOVE_UP);
|
| + if (IsEditCommandEnabled(ui::TextEditCommand::MOVE_UP)) {
|
| + ExecuteEditCommand(ui::TextEditCommand::MOVE_UP);
|
| return true;
|
| }
|
| break;
|
| case ui::VKEY_DOWN:
|
| - if (IsEditCommandEnabled(IDS_MOVE_DOWN)) {
|
| - ExecuteEditCommand(IDS_MOVE_DOWN);
|
| + if (IsEditCommandEnabled(ui::TextEditCommand::MOVE_DOWN)) {
|
| + ExecuteEditCommand(ui::TextEditCommand::MOVE_DOWN);
|
| return true;
|
| }
|
| break;
|
| @@ -776,14 +777,15 @@ bool OmniboxViewViews::OnKeyPressed(const ui::KeyEvent& event) {
|
| model()->OnUpOrDownKeyPressed(model()->result().size());
|
| return true;
|
| case ui::VKEY_V:
|
| - if (control && !alt && IsEditCommandEnabled(IDS_APP_PASTE)) {
|
| - ExecuteEditCommand(IDS_APP_PASTE);
|
| + if (control && !alt && IsEditCommandEnabled(ui::TextEditCommand::PASTE)) {
|
| + ExecuteEditCommand(ui::TextEditCommand::PASTE);
|
| return true;
|
| }
|
| break;
|
| case ui::VKEY_INSERT:
|
| - if (shift && !control && IsEditCommandEnabled(IDS_APP_PASTE)) {
|
| - ExecuteEditCommand(IDS_APP_PASTE);
|
| + if (shift && !control &&
|
| + IsEditCommandEnabled(ui::TextEditCommand::PASTE)) {
|
| + ExecuteEditCommand(ui::TextEditCommand::PASTE);
|
| return true;
|
| }
|
| break;
|
| @@ -920,39 +922,39 @@ void OmniboxViewViews::DoInsertChar(base::char16 ch) {
|
| Textfield::DoInsertChar(ch);
|
| }
|
|
|
| -bool OmniboxViewViews::IsEditCommandEnabled(int command_id) const {
|
| - switch (command_id) {
|
| - case IDS_MOVE_UP:
|
| - case IDS_MOVE_DOWN:
|
| +bool OmniboxViewViews::IsEditCommandEnabled(ui::TextEditCommand command) const {
|
| + switch (command) {
|
| + case ui::TextEditCommand::MOVE_UP:
|
| + case ui::TextEditCommand::MOVE_DOWN:
|
| return !read_only();
|
| - case IDS_APP_PASTE:
|
| + case ui::TextEditCommand::PASTE:
|
| return !read_only() && !GetClipboardText().empty();
|
| default:
|
| - return Textfield::IsEditCommandEnabled(command_id);
|
| + return Textfield::IsEditCommandEnabled(command);
|
| }
|
| }
|
|
|
| -void OmniboxViewViews::ExecuteEditCommand(int command_id) {
|
| +void OmniboxViewViews::ExecuteEditCommand(ui::TextEditCommand command) {
|
| // In the base class, touch text selection is deactivated when a command is
|
| // executed. Since we are not always calling the base class implementation
|
| // here, we need to deactivate touch text selection here, too.
|
| DestroyTouchSelection();
|
|
|
| - if (!IsEditCommandEnabled(command_id))
|
| + if (!IsEditCommandEnabled(command))
|
| return;
|
|
|
| - switch (command_id) {
|
| - case IDS_MOVE_UP:
|
| + switch (command) {
|
| + case ui::TextEditCommand::MOVE_UP:
|
| model()->OnUpOrDownKeyPressed(-1);
|
| break;
|
| - case IDS_MOVE_DOWN:
|
| + case ui::TextEditCommand::MOVE_DOWN:
|
| model()->OnUpOrDownKeyPressed(1);
|
| break;
|
| - case IDS_APP_PASTE:
|
| + case ui::TextEditCommand::PASTE:
|
| OnPaste();
|
| break;
|
| default:
|
| - Textfield::ExecuteEditCommand(command_id);
|
| + Textfield::ExecuteEditCommand(command);
|
| break;
|
| }
|
| }
|
|
|