Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 14259008: Instant Extended: Add prominent search term support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE); 762 int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE);
763 DCHECK(paste_position >= 0); 763 DCHECK(paste_position >= 0);
764 menu_contents->InsertItemWithStringIdAt( 764 menu_contents->InsertItemWithStringIdAt(
765 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); 765 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO);
766 } 766 }
767 767
768 bool OmniboxViewViews::IsCommandIdEnabled(int command_id) const { 768 bool OmniboxViewViews::IsCommandIdEnabled(int command_id) const {
769 if (command_id == IDS_PASTE_AND_GO) 769 if (command_id == IDS_PASTE_AND_GO)
770 return model()->CanPasteAndGo(GetClipboardText()); 770 return model()->CanPasteAndGo(GetClipboardText());
771 if (command_id == IDC_COPY_URL) { 771 if (command_id == IDC_COPY_URL) {
772 return toolbar_model()->WouldReplaceSearchURLWithSearchTerms() && 772 return !model()->user_input_in_progress() &&
773 !model()->user_input_in_progress(); 773 (toolbar_model()->GetSearchTermsType() !=
774 ToolbarModel::NO_SEARCH_TERMS);
774 } 775 }
775 return command_updater()->IsCommandEnabled(command_id); 776 return command_updater()->IsCommandEnabled(command_id);
776 } 777 }
777 778
778 bool OmniboxViewViews::IsItemForCommandIdDynamic(int command_id) const { 779 bool OmniboxViewViews::IsItemForCommandIdDynamic(int command_id) const {
779 return command_id == IDS_PASTE_AND_GO; 780 return command_id == IDS_PASTE_AND_GO;
780 } 781 }
781 782
782 string16 OmniboxViewViews::GetLabelForCommandId(int command_id) const { 783 string16 OmniboxViewViews::GetLabelForCommandId(int command_id) const {
783 if (command_id == IDS_PASTE_AND_GO) { 784 if (command_id == IDS_PASTE_AND_GO) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 const string16 text(GetClipboardText()); 904 const string16 text(GetClipboardText());
904 if (!text.empty()) { 905 if (!text.empty()) {
905 // Record this paste, so we can do different behavior. 906 // Record this paste, so we can do different behavior.
906 model()->on_paste(); 907 model()->on_paste();
907 // Force a Paste operation to trigger the text_changed code in 908 // Force a Paste operation to trigger the text_changed code in
908 // OnAfterPossibleChange(), even if identical contents are pasted. 909 // OnAfterPossibleChange(), even if identical contents are pasted.
909 text_before_change_.clear(); 910 text_before_change_.clear();
910 ReplaceSelection(text); 911 ReplaceSelection(text);
911 } 912 }
912 } 913 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698