Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 case IDC_EDIT_SEARCH_ENGINES: | 363 case IDC_EDIT_SEARCH_ENGINES: |
| 364 location_bar_view_->command_updater()->ExecuteCommand(command_id); | 364 location_bar_view_->command_updater()->ExecuteCommand(command_id); |
| 365 return; | 365 return; |
| 366 case IDS_MOVE_DOWN: | 366 case IDS_MOVE_DOWN: |
| 367 case IDS_MOVE_UP: | 367 case IDS_MOVE_UP: |
| 368 model()->OnUpOrDownKeyPressed(command_id == IDS_MOVE_DOWN ? 1 : -1); | 368 model()->OnUpOrDownKeyPressed(command_id == IDS_MOVE_DOWN ? 1 : -1); |
| 369 return; | 369 return; |
| 370 | 370 |
| 371 // These commands do invoke the popup. | 371 // These commands do invoke the popup. |
| 372 case IDS_APP_PASTE: | 372 case IDS_APP_PASTE: |
| 373 OnPaste(); | 373 if (Textfield::IsCommandIdEnabled(command_id)) { |
|
Peter Kasting
2016/03/25 21:28:37
Use IsCommandIdEnabled() here rather than the Text
| |
| 374 OnPaste(); | |
| 375 } | |
| 374 return; | 376 return; |
| 375 default: | 377 default: |
| 376 if (Textfield::IsCommandIdEnabled(command_id)) { | 378 if (Textfield::IsCommandIdEnabled(command_id)) { |
| 377 // The Textfield code will invoke OnBefore/AfterPossibleChange() itself | 379 // The Textfield code will invoke OnBefore/AfterPossibleChange() itself |
| 378 // as necessary. | 380 // as necessary. |
| 379 Textfield::ExecuteCommand(command_id, event_flags); | 381 Textfield::ExecuteCommand(command_id, event_flags); |
| 380 return; | 382 return; |
| 381 } | 383 } |
| 382 OnBeforePossibleChange(); | 384 OnBeforePossibleChange(); |
| 383 location_bar_view_->command_updater()->ExecuteCommand(command_id); | 385 location_bar_view_->command_updater()->ExecuteCommand(command_id); |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1074 menu_contents->InsertItemWithStringIdAt( | 1076 menu_contents->InsertItemWithStringIdAt( |
| 1075 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1077 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
| 1076 } | 1078 } |
| 1077 | 1079 |
| 1078 // Minor note: We use IDC_ for command id here while the underlying textfield | 1080 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 1079 // is using IDS_ for all its command ids. This is because views cannot depend | 1081 // is using IDS_ for all its command ids. This is because views cannot depend |
| 1080 // on IDC_ for now. | 1082 // on IDC_ for now. |
| 1081 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1083 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 1082 IDS_EDIT_SEARCH_ENGINES); | 1084 IDS_EDIT_SEARCH_ENGINES); |
| 1083 } | 1085 } |
| OLD | NEW |