OLD | NEW |
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 "base/mac/mac_util.h" | 8 #import "base/mac/mac_util.h" |
9 #import "base/mac/sdk_forward_declarations.h" | 9 #import "base/mac/sdk_forward_declarations.h" |
10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // select the entire field. | 152 // select the entire field. |
153 // NOTE(shess): This does not interfere with single-clicking to | 153 // NOTE(shess): This does not interfere with single-clicking to |
154 // place caret after a selection is made. An NSTextField only has | 154 // place caret after a selection is made. An NSTextField only has |
155 // a selection when it has a field editor. The field editor is an | 155 // a selection when it has a field editor. The field editor is an |
156 // NSText subview, which will receive the -mouseDown: in that | 156 // NSText subview, which will receive the -mouseDown: in that |
157 // case, and this code will never fire. | 157 // case, and this code will never fire. |
158 NSText* editor = [self currentEditor]; | 158 NSText* editor = [self currentEditor]; |
159 if (editor) { | 159 if (editor) { |
160 NSEvent* currentEvent = [NSApp currentEvent]; | 160 NSEvent* currentEvent = [NSApp currentEvent]; |
161 if ([currentEvent type] == NSLeftMouseUp && | 161 if ([currentEvent type] == NSLeftMouseUp && |
162 ![editor selectedRange].length && | 162 ![editor selectedRange].length) { |
163 (!observer_ || observer_->ShouldSelectAllOnMouseDown())) { | |
164 [editor selectAll:nil]; | 163 [editor selectAll:nil]; |
165 } | 164 } |
166 } | 165 } |
167 | 166 |
168 return; | 167 return; |
169 } | 168 } |
170 | 169 |
171 // Give the cell a chance to intercept clicks in page-actions and | 170 // Give the cell a chance to intercept clicks in page-actions and |
172 // other decorative items. | 171 // other decorative items. |
173 if ([cell mouseDown:theEvent inRect:bounds ofView:self]) { | 172 if ([cell mouseDown:theEvent inRect:bounds ofView:self]) { |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 NSMinY(frame), | 584 NSMinY(frame), |
586 suggestWidth, | 585 suggestWidth, |
587 NSHeight(frame)); | 586 NSHeight(frame)); |
588 | 587 |
589 gfx::ScopedNSGraphicsContextSaveGState saveGState; | 588 gfx::ScopedNSGraphicsContextSaveGState saveGState; |
590 NSRectClip(suggestRect); | 589 NSRectClip(suggestRect); |
591 [cell drawInteriorWithFrame:frame inView:controlView]; | 590 [cell drawInteriorWithFrame:frame inView:controlView]; |
592 } | 591 } |
593 | 592 |
594 } // namespace autocomplete_text_field | 593 } // namespace autocomplete_text_field |
OLD | NEW |