| 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/location_bar/autocomplete_text_field.h" | 5 #import "chrome/browser/cocoa/location_bar/autocomplete_text_field.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "chrome/browser/cocoa/browser_window_controller.h" | 8 #import "chrome/browser/cocoa/browser_window_controller.h" |
| 9 #import "chrome/browser/cocoa/location_bar/autocomplete_text_field_cell.h" | 9 #import "chrome/browser/cocoa/location_bar/autocomplete_text_field_cell.h" |
| 10 #import "chrome/browser/cocoa/location_bar/autocomplete_text_field_editor.h" | 10 #import "chrome/browser/cocoa/location_bar/autocomplete_text_field_editor.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // (Page Actions or the security icon) in which case show the arrow cursor. | 204 // (Page Actions or the security icon) in which case show the arrow cursor. |
| 205 // TODO(rohitrao): Should default to the arrow cursor. http://crbug.com/41612 | 205 // TODO(rohitrao): Should default to the arrow cursor. http://crbug.com/41612 |
| 206 - (void)resetCursorRects { | 206 - (void)resetCursorRects { |
| 207 NSRect fieldBounds = [self bounds]; | 207 NSRect fieldBounds = [self bounds]; |
| 208 [self addCursorRect:fieldBounds cursor:[NSCursor IBeamCursor]]; | 208 [self addCursorRect:fieldBounds cursor:[NSCursor IBeamCursor]]; |
| 209 | 209 |
| 210 AutocompleteTextFieldCell* cell = [self autocompleteTextFieldCell]; | 210 AutocompleteTextFieldCell* cell = [self autocompleteTextFieldCell]; |
| 211 for (AutocompleteTextFieldIcon* icon in [cell layedOutIcons:fieldBounds]) | 211 for (AutocompleteTextFieldIcon* icon in [cell layedOutIcons:fieldBounds]) |
| 212 [self addCursorRect:[icon rect] cursor:[NSCursor arrowCursor]]; | 212 [self addCursorRect:[icon rect] cursor:[NSCursor arrowCursor]]; |
| 213 | 213 |
| 214 // Special-case the location image, since it is not in |-layedOutIcons|. | 214 // TODO(shess): This needs to traverse the LocationBarDecorations |
| 215 const NSRect locationIconFrame = [cell locationIconFrameForFrame:fieldBounds]; | 215 // and put up a cursor for them, too. Except for the keyword-search |
| 216 [self addCursorRect:locationIconFrame cursor:[NSCursor arrowCursor]]; | 216 // stuff? Sigh. |
| 217 } | 217 } |
| 218 | 218 |
| 219 // TODO(shess): -resetFieldEditorFrameIfNeeded is the place where | 219 // TODO(shess): -resetFieldEditorFrameIfNeeded is the place where |
| 220 // changes to the cell layout should be flushed. LocationBarViewMac | 220 // changes to the cell layout should be flushed. LocationBarViewMac |
| 221 // and ToolbarController are calling this routine directly, and I | 221 // and ToolbarController are calling this routine directly, and I |
| 222 // think they are probably wrong. | 222 // think they are probably wrong. |
| 223 // http://crbug.com/40053 | 223 // http://crbug.com/40053 |
| 224 - (void)updateCursorAndToolTipRects { | 224 - (void)updateCursorAndToolTipRects { |
| 225 // This will force |resetCursorRects| to be called, as it is not to be called | 225 // This will force |resetCursorRects| to be called, as it is not to be called |
| 226 // directly. | 226 // directly. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // (URLDropTarget protocol) | 398 // (URLDropTarget protocol) |
| 399 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { | 399 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { |
| 400 return [dropHandler_ performDragOperation:sender]; | 400 return [dropHandler_ performDragOperation:sender]; |
| 401 } | 401 } |
| 402 | 402 |
| 403 - (NSMenu*)actionMenuForEvent:(NSEvent*)event { | 403 - (NSMenu*)actionMenuForEvent:(NSEvent*)event { |
| 404 return [[self autocompleteTextFieldCell] | 404 return [[self autocompleteTextFieldCell] |
| 405 actionMenuForEvent:event inRect:[self bounds] ofView:self]; | 405 actionMenuForEvent:event inRect:[self bounds] ofView:self]; |
| 406 } | 406 } |
| 407 | 407 |
| 408 - (NSPasteboard*)locationDragPasteboard { | |
| 409 return [[self autocompleteTextFieldCell] locationDragPasteboard]; | |
| 410 } | |
| 411 | |
| 412 @end | 408 @end |
| OLD | NEW |