| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 return ui::DragDropTypes::DRAG_NONE; | 748 return ui::DragDropTypes::DRAG_NONE; |
| 749 } | 749 } |
| 750 | 750 |
| 751 void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { | 751 void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { |
| 752 // Minor note: We use IDC_ for command id here while the underlying textfield | 752 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 753 // is using IDS_ for all its command ids. This is because views cannot depend | 753 // is using IDS_ for all its command ids. This is because views cannot depend |
| 754 // on IDC_ for now. | 754 // on IDC_ for now. |
| 755 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 755 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 756 IDS_EDIT_SEARCH_ENGINES); | 756 IDS_EDIT_SEARCH_ENGINES); |
| 757 | 757 |
| 758 if (chrome::IsQueryExtractionEnabled()) { | 758 if (chrome::IsQueryExtractionEnabled(model()->profile())) { |
| 759 int copy_position = menu_contents->GetIndexOfCommandId(IDS_APP_COPY); | 759 int copy_position = menu_contents->GetIndexOfCommandId(IDS_APP_COPY); |
| 760 DCHECK(copy_position >= 0); | 760 DCHECK(copy_position >= 0); |
| 761 menu_contents->InsertItemWithStringIdAt( | 761 menu_contents->InsertItemWithStringIdAt( |
| 762 copy_position + 1, IDC_COPY_URL, IDS_COPY_URL); | 762 copy_position + 1, IDC_COPY_URL, IDS_COPY_URL); |
| 763 } | 763 } |
| 764 | 764 |
| 765 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE); | 765 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE); |
| 766 DCHECK(paste_position >= 0); | 766 DCHECK(paste_position >= 0); |
| 767 menu_contents->InsertItemWithStringIdAt( | 767 menu_contents->InsertItemWithStringIdAt( |
| 768 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 768 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 const string16 text(GetClipboardText()); | 907 const string16 text(GetClipboardText()); |
| 908 if (!text.empty()) { | 908 if (!text.empty()) { |
| 909 // Record this paste, so we can do different behavior. | 909 // Record this paste, so we can do different behavior. |
| 910 model()->on_paste(); | 910 model()->on_paste(); |
| 911 // Force a Paste operation to trigger the text_changed code in | 911 // Force a Paste operation to trigger the text_changed code in |
| 912 // OnAfterPossibleChange(), even if identical contents are pasted. | 912 // OnAfterPossibleChange(), even if identical contents are pasted. |
| 913 text_before_change_.clear(); | 913 text_before_change_.clear(); |
| 914 ReplaceSelection(text); | 914 ReplaceSelection(text); |
| 915 } | 915 } |
| 916 } | 916 } |
| OLD | NEW |