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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 return ui::DragDropTypes::DRAG_NONE; | 727 return ui::DragDropTypes::DRAG_NONE; |
728 } | 728 } |
729 | 729 |
730 void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { | 730 void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { |
731 // Minor note: We use IDC_ for command id here while the underlying textfield | 731 // Minor note: We use IDC_ for command id here while the underlying textfield |
732 // is using IDS_ for all its command ids. This is because views cannot depend | 732 // is using IDS_ for all its command ids. This is because views cannot depend |
733 // on IDC_ for now. | 733 // on IDC_ for now. |
734 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 734 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
735 IDS_EDIT_SEARCH_ENGINES); | 735 IDS_EDIT_SEARCH_ENGINES); |
736 | 736 |
737 if (chrome::IsQueryExtractionEnabled(model()->profile())) { | 737 if (chrome::IsQueryExtractionEnabled()) { |
738 int copy_position = menu_contents->GetIndexOfCommandId(IDS_APP_COPY); | 738 int copy_position = menu_contents->GetIndexOfCommandId(IDS_APP_COPY); |
739 DCHECK(copy_position >= 0); | 739 DCHECK(copy_position >= 0); |
740 menu_contents->InsertItemWithStringIdAt( | 740 menu_contents->InsertItemWithStringIdAt( |
741 copy_position + 1, IDC_COPY_URL, IDS_COPY_URL); | 741 copy_position + 1, IDC_COPY_URL, IDS_COPY_URL); |
742 } | 742 } |
743 | 743 |
744 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE); | 744 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE); |
745 DCHECK(paste_position >= 0); | 745 DCHECK(paste_position >= 0); |
746 menu_contents->InsertItemWithStringIdAt( | 746 menu_contents->InsertItemWithStringIdAt( |
747 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 747 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 const string16 text(GetClipboardText()); | 881 const string16 text(GetClipboardText()); |
882 if (!text.empty()) { | 882 if (!text.empty()) { |
883 // Record this paste, so we can do different behavior. | 883 // Record this paste, so we can do different behavior. |
884 model()->on_paste(); | 884 model()->on_paste(); |
885 // Force a Paste operation to trigger the text_changed code in | 885 // Force a Paste operation to trigger the text_changed code in |
886 // OnAfterPossibleChange(), even if identical contents are pasted. | 886 // OnAfterPossibleChange(), even if identical contents are pasted. |
887 text_before_change_.clear(); | 887 text_before_change_.clear(); |
888 ReplaceSelection(text); | 888 ReplaceSelection(text); |
889 } | 889 } |
890 } | 890 } |
OLD | NEW |