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

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

Issue 23526044: Disable click to select all for search terms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // select the entire field. 121 // select the entire field.
122 // NOTE(shess): This does not interfere with single-clicking to 122 // NOTE(shess): This does not interfere with single-clicking to
123 // place caret after a selection is made. An NSTextField only has 123 // place caret after a selection is made. An NSTextField only has
124 // a selection when it has a field editor. The field editor is an 124 // a selection when it has a field editor. The field editor is an
125 // NSText subview, which will receive the -mouseDown: in that 125 // NSText subview, which will receive the -mouseDown: in that
126 // case, and this code will never fire. 126 // case, and this code will never fire.
127 NSText* editor = [self currentEditor]; 127 NSText* editor = [self currentEditor];
128 if (editor) { 128 if (editor) {
129 NSEvent* currentEvent = [NSApp currentEvent]; 129 NSEvent* currentEvent = [NSApp currentEvent];
130 if ([currentEvent type] == NSLeftMouseUp && 130 if ([currentEvent type] == NSLeftMouseUp &&
131 ![editor selectedRange].length) { 131 ![editor selectedRange].length &&
132 (!observer_ || observer_->ShouldSelectAllOnMouseDown())) {
132 [editor selectAll:nil]; 133 [editor selectAll:nil];
133 } 134 }
134 } 135 }
135 136
136 return; 137 return;
137 } 138 }
138 139
139 // Give the cell a chance to intercept clicks in page-actions and 140 // Give the cell a chance to intercept clicks in page-actions and
140 // other decorative items. 141 // other decorative items.
141 if ([cell mouseDown:theEvent inRect:bounds ofView:self]) { 142 if ([cell mouseDown:theEvent inRect:bounds ofView:self]) {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 NSMinY(frame), 471 NSMinY(frame),
471 suggestWidth, 472 suggestWidth,
472 NSHeight(frame)); 473 NSHeight(frame));
473 474
474 gfx::ScopedNSGraphicsContextSaveGState saveGState; 475 gfx::ScopedNSGraphicsContextSaveGState saveGState;
475 NSRectClip(suggestRect); 476 NSRectClip(suggestRect);
476 [cell drawInteriorWithFrame:frame inView:controlView]; 477 [cell drawInteriorWithFrame:frame inView:controlView];
477 } 478 }
478 479
479 } // namespace autocomplete_text_field 480 } // namespace autocomplete_text_field
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698