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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm

Issue 10836270: Do not close the omnibox popup on mouseDown. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove -mouseDown from editor. Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 8 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
9 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" 9 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" 10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // field editor area, and if so sets the selection to {0,0} to clear 71 // field editor area, and if so sets the selection to {0,0} to clear
72 // the selection before forwarding the event to the field editor for 72 // the selection before forwarding the event to the field editor for
73 // processing (it will set the cursor position). This also starts the 73 // processing (it will set the cursor position). This also starts the
74 // click-drag selection machinery. 74 // click-drag selection machinery.
75 // 75 //
76 // This code does the same thing for cases where the click was in the 76 // This code does the same thing for cases where the click was in the
77 // decoration area. This allows the user to click-drag starting from 77 // decoration area. This allows the user to click-drag starting from
78 // a decoration area and get the expected selection behaviour, 78 // a decoration area and get the expected selection behaviour,
79 // likewise for multiple clicks in those areas. 79 // likewise for multiple clicks in those areas.
80 - (void)mouseDown:(NSEvent*)theEvent { 80 - (void)mouseDown:(NSEvent*)theEvent {
81 // Close the popup before processing the event. This prevents the
82 // popup from being visible while a right-click context menu or
83 // page-action menu is visible. Also, it matches other platforms.
84 if (observer_)
85 observer_->ClosePopup();
86
87 // If the click was a Control-click, bring up the context menu. 81 // If the click was a Control-click, bring up the context menu.
88 // |NSTextField| handles these cases inconsistently if the field is 82 // |NSTextField| handles these cases inconsistently if the field is
89 // not already first responder. 83 // not already first responder.
90 if (([theEvent modifierFlags] & NSControlKeyMask) != 0) { 84 if (([theEvent modifierFlags] & NSControlKeyMask) != 0) {
91 NSText* editor = [self currentEditor]; 85 NSText* editor = [self currentEditor];
92 NSMenu* menu = [editor menuForEvent:theEvent]; 86 NSMenu* menu = [editor menuForEvent:theEvent];
93 [NSMenu popUpContextMenu:menu withEvent:theEvent forView:editor]; 87 [NSMenu popUpContextMenu:menu withEvent:theEvent forView:editor];
94 return; 88 return;
95 } 89 }
96 90
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 - (NSMenu*)decorationMenuForEvent:(NSEvent*)event { 377 - (NSMenu*)decorationMenuForEvent:(NSEvent*)event {
384 AutocompleteTextFieldCell* cell = [self cell]; 378 AutocompleteTextFieldCell* cell = [self cell];
385 return [cell decorationMenuForEvent:event inRect:[self bounds] ofView:self]; 379 return [cell decorationMenuForEvent:event inRect:[self bounds] ofView:self];
386 } 380 }
387 381
388 - (ViewID)viewID { 382 - (ViewID)viewID {
389 return VIEW_ID_LOCATION_BAR; 383 return VIEW_ID_LOCATION_BAR;
390 } 384 }
391 385
392 @end 386 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698