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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 10704074: "Paste and go" state was being calculated wrong on views (at least). Fix by making this calculatio… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc
===================================================================
--- chrome/browser/ui/views/omnibox/omnibox_view_win.cc (revision 144499)
+++ chrome/browser/ui/views/omnibox/omnibox_view_win.cc (working copy)
@@ -1026,7 +1026,9 @@
else
InsertText(string_drop_position, text);
} else {
- PasteAndGo(CollapseWhitespace(text, true));
+ string16 collapsed_text(CollapseWhitespace(text, true));
+ if (model_->CanPasteAndGo(collapsed_text))
+ model_->PasteAndGo(collapsed_text);
}
return CopyOrLinkDragOperation(event.source_operations());
}
@@ -1035,11 +1037,6 @@
return ui::DragDropTypes::DRAG_NONE;
}
-void OmniboxViewWin::PasteAndGo(const string16& text) {
- if (CanPasteAndGo(text))
- model_->PasteAndGo();
-}
-
bool OmniboxViewWin::SkipDefaultKeyEventProcessing(
const views::KeyEvent& event) {
ui::KeyboardCode key = event.key_code();
@@ -1111,7 +1108,7 @@
case IDC_CUT: return !!CanCut();
case IDC_COPY: return !!CanCopy();
case IDC_PASTE: return !!CanPaste();
- case IDS_PASTE_AND_GO: return CanPasteAndGo(GetClipboardText());
+ case IDS_PASTE_AND_GO: return model_->CanPasteAndGo(GetClipboardText());
case IDS_SELECT_ALL: return !!CanSelectAll();
case IDS_EDIT_SEARCH_ENGINES:
return command_updater_->IsCommandEnabled(IDC_EDIT_SEARCH_ENGINES);
@@ -1135,7 +1132,8 @@
string16 OmniboxViewWin::GetLabelForCommandId(int command_id) const {
DCHECK_EQ(IDS_PASTE_AND_GO, command_id);
- return l10n_util::GetStringUTF16(model_->is_paste_and_search() ?
+ return l10n_util::GetStringUTF16(
+ model_->IsPasteAndSearch(GetClipboardText()) ?
IDS_PASTE_AND_SEARCH : IDS_PASTE_AND_GO);
}
@@ -1144,7 +1142,7 @@
if (command_id == IDS_PASTE_AND_GO) {
// This case is separate from the switch() below since we don't want to wrap
// it in OnBefore/AfterPossibleChange() calls.
- model_->PasteAndGo();
+ model_->PasteAndGo(GetClipboardText());
return;
}
@@ -2462,10 +2460,6 @@
model_->OnChanged();
}
-bool OmniboxViewWin::CanPasteAndGo(const string16& text) const {
- return !popup_window_mode_ && model_->CanPasteAndGo(text);
-}
-
ITextDocument* OmniboxViewWin::GetTextObjectModel() const {
if (!text_object_model_) {
// This is lazily initialized, instead of being initialized in the
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698