OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/autocomplete_text_field.h" | 5 #import "chrome/browser/cocoa/autocomplete_text_field.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" | 8 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" |
9 #import "chrome/browser/cocoa/browser_window_controller.h" | 9 #import "chrome/browser/cocoa/browser_window_controller.h" |
10 #import "chrome/browser/cocoa/toolbar_controller.h" | 10 #import "chrome/browser/cocoa/toolbar_controller.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 NSEvent* currentEvent = [NSApp currentEvent]; | 117 NSEvent* currentEvent = [NSApp currentEvent]; |
118 if ([currentEvent type] == NSLeftMouseUp && | 118 if ([currentEvent type] == NSLeftMouseUp && |
119 ![editor selectedRange].length) { | 119 ![editor selectedRange].length) { |
120 [editor selectAll:nil]; | 120 [editor selectAll:nil]; |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 return; | 124 return; |
125 } | 125 } |
126 | 126 |
127 // If the user clicked on one of the icons (security icon, Page | 127 // Give the cell a chance to intercept clicks in page-actions and |
128 // Actions, etc), let the icon handle the click. | 128 // other decorative items. |
129 for (AutocompleteTextFieldIcon* icon in [cell layedOutIcons:bounds]) { | 129 if ([cell mouseDown:theEvent inRect:bounds ofView:self]) { |
130 const NSRect iconRect = [icon rect]; | 130 return; |
131 if (NSMouseInRect(location, iconRect, flipped)) { | |
132 [icon view]->OnMousePressed(iconRect); | |
133 return; | |
134 } | |
135 } | 131 } |
136 | 132 |
137 NSText* editor = [self currentEditor]; | 133 NSText* editor = [self currentEditor]; |
138 | 134 |
139 // We should only be here if we accepted first-responder status and | 135 // We should only be here if we accepted first-responder status and |
140 // have a field editor. If one of these fires, it means some | 136 // have a field editor. If one of these fires, it means some |
141 // assumptions are being broken. | 137 // assumptions are being broken. |
142 DCHECK(editor != nil); | 138 DCHECK(editor != nil); |
143 DCHECK([editor isDescendantOf:self]); | 139 DCHECK([editor isDescendantOf:self]); |
144 | 140 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { | 361 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { |
366 return [dropHandler_ performDragOperation:sender]; | 362 return [dropHandler_ performDragOperation:sender]; |
367 } | 363 } |
368 | 364 |
369 - (NSMenu*)actionMenuForEvent:(NSEvent*)event { | 365 - (NSMenu*)actionMenuForEvent:(NSEvent*)event { |
370 return [[self autocompleteTextFieldCell] | 366 return [[self autocompleteTextFieldCell] |
371 actionMenuForEvent:event inRect:[self bounds] ofView:self]; | 367 actionMenuForEvent:event inRect:[self bounds] ofView:self]; |
372 } | 368 } |
373 | 369 |
374 @end | 370 @end |
OLD | NEW |