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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.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 | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm ('k') | no next file » | 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_editor.h" 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" // IDC_* 9 #include "chrome/app/chrome_command_ids.h" // IDC_*
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 NSTextStorage* textStorage = [self textStorage]; 461 NSTextStorage* textStorage = [self textStorage];
462 DCHECK(textStorage); 462 DCHECK(textStorage);
463 [textStorage setAttributedString:aString]; 463 [textStorage setAttributedString:aString];
464 464
465 // The text has been changed programmatically. The observer should know 465 // The text has been changed programmatically. The observer should know
466 // this change, so setting |textChangedByKeyEvents_| to NO to 466 // this change, so setting |textChangedByKeyEvents_| to NO to
467 // prevent its OnDidChange() method from being called unnecessarily. 467 // prevent its OnDidChange() method from being called unnecessarily.
468 textChangedByKeyEvents_ = NO; 468 textChangedByKeyEvents_ = NO;
469 } 469 }
470 470
471 - (void)mouseDown:(NSEvent*)theEvent {
472 // Close the popup before processing the event.
473 AutocompleteTextFieldObserver* observer = [self observer];
474 if (observer)
475 observer->ClosePopup();
476
477 [super mouseDown:theEvent];
478 }
479
480 - (BOOL)validateMenuItem:(NSMenuItem*)item { 471 - (BOOL)validateMenuItem:(NSMenuItem*)item {
481 if ([item action] == @selector(copyToFindPboard:)) 472 if ([item action] == @selector(copyToFindPboard:))
482 return [self selectedRange].length > 0; 473 return [self selectedRange].length > 0;
483 return [super validateMenuItem:item]; 474 return [super validateMenuItem:item];
484 } 475 }
485 476
486 - (void)copyToFindPboard:(id)sender { 477 - (void)copyToFindPboard:(id)sender {
487 NSRange selectedRange = [self selectedRange]; 478 NSRange selectedRange = [self selectedRange];
488 if (selectedRange.length == 0) 479 if (selectedRange.length == 0)
489 return; 480 return;
490 NSAttributedString* selection = 481 NSAttributedString* selection =
491 [self attributedSubstringForProposedRange:selectedRange 482 [self attributedSubstringForProposedRange:selectedRange
492 actualRange:NULL]; 483 actualRange:NULL];
493 if (!selection) 484 if (!selection)
494 return; 485 return;
495 486
496 [[FindPasteboard sharedInstance] setFindText:[selection string]]; 487 [[FindPasteboard sharedInstance] setFindText:[selection string]];
497 } 488 }
498 489
499 @end 490 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698