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

Unified Diff: chrome/browser/autocomplete/autocomplete_popup_view_mac.mm

Issue 260008: [Mac] Cmd-Return in the omnibox should revert the omnibox text back to its or... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/autocomplete/autocomplete_popup_view_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
===================================================================
--- chrome/browser/autocomplete/autocomplete_popup_view_mac.mm (revision 29719)
+++ chrome/browser/autocomplete/autocomplete_popup_view_mac.mm (working copy)
@@ -454,7 +454,7 @@
return model_.get();
}
-void AutocompletePopupViewMac::AcceptInput() {
+void AutocompletePopupViewMac::OnClick() {
const NSInteger selectedRow = [[popup_ contentView] selectedRow];
// -1 means no cells were selected. This can happen if the user
@@ -463,19 +463,25 @@
if (selectedRow == -1) {
PaintUpdatesNow();
} else {
- model_->SetSelectedLine(selectedRow, false);
- WindowOpenDisposition disposition =
- event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]);
- edit_view_->AcceptInput(disposition, false);
+ OpenURLForRow(selectedRow, false);
}
}
void AutocompletePopupViewMac::OnMiddleClick() {
- const NSInteger row = [[popup_ contentView] highlightedRow];
+ OpenURLForRow([[popup_ contentView] highlightedRow], true);
+}
+
+void AutocompletePopupViewMac::OpenURLForRow(int row, bool force_background) {
if (row == -1) {
return;
}
+ WindowOpenDisposition disposition = NEW_BACKGROUND_TAB;
+ if (!force_background) {
+ disposition =
+ event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]);
+ }
+
// OpenURL() may close the popup, which will clear the result set
// and, by extension, |match| and its contents. So copy the
// relevant strings out to make sure they stay alive until the call
@@ -484,7 +490,7 @@
const GURL url(match.destination_url);
std::wstring keyword;
const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword);
- edit_view_->OpenURL(url, NEW_BACKGROUND_TAB, match.transition, GURL(), row,
+ edit_view_->OpenURL(url, disposition, match.transition, GURL(), row,
is_keyword_hint ? std::wstring() : keyword);
}
@@ -713,7 +719,7 @@
- (void)select:(id)sender {
DCHECK(popup_view_);
- popup_view_->AcceptInput();
+ popup_view_->OnClick();
}
- (void)middleSelect:(id)sender {
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_popup_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698