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

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

Issue 10386085: Support 'Paste and Go' action in omnibox Aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 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/omnibox/omnibox_view.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_view_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/omnibox/omnibox_view_views.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index 186df96991b41eb6857928f06694f3c9eddc4d1f..a1f6c6ae2ed85d5cbaa2ec1c3dee7441b8689ab9 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -21,6 +21,7 @@
#include "googleurl/src/gurl.h"
#include "grit/app_locale_settings.h"
#include "grit/generated_resources.h"
+#include "grit/ui_strings.h"
#include "net/base/escape.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/accessibility/accessible_view_state.h"
@@ -758,13 +759,26 @@ void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) {
// on IDC_ for now.
menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
IDS_EDIT_SEARCH_ENGINES);
+
+ int paste_position = menu_contents->GetIndexOfCommandId(IDS_APP_PASTE);
+ if (paste_position >= 0)
+ menu_contents->InsertItemWithStringIdAt(
+ paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO);
}
bool OmniboxViewViews::IsCommandIdEnabled(int command_id) const {
+ if (command_id == IDS_PASTE_AND_GO)
+ return !popup_window_mode_ && model_->CanPasteAndGo(GetClipboardText());
+
return command_updater_->IsCommandEnabled(command_id);
}
void OmniboxViewViews::ExecuteCommand(int command_id) {
+ if (command_id == IDS_PASTE_AND_GO) {
+ model_->PasteAndGo();
+ return;
+ }
+
command_updater_->ExecuteCommand(command_id);
}
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_view_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698