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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 - (NSUndoManager*)undoManagerForTextView:(NSTextView*)textView { | 197 - (NSUndoManager*)undoManagerForTextView:(NSTextView*)textView { |
198 if (!undoManager_.get()) | 198 if (!undoManager_.get()) |
199 undoManager_.reset([[NSUndoManager alloc] init]); | 199 undoManager_.reset([[NSUndoManager alloc] init]); |
200 return undoManager_.get(); | 200 return undoManager_.get(); |
201 } | 201 } |
202 | 202 |
203 - (void)clearUndoChain { | 203 - (void)clearUndoChain { |
204 [undoManager_ removeAllActions]; | 204 [undoManager_ removeAllActions]; |
205 } | 205 } |
206 | 206 |
207 // Show the I-beam cursor unless the mouse is over an image within the field | |
208 // (Page Actions or the security icon) in which case show the arrow cursor. | |
209 // TODO(rohitrao): Should default to the arrow cursor. http://crbug.com/41612 | |
210 - (void)resetCursorRects { | |
211 NSRect fieldBounds = [self bounds]; | |
212 [self addCursorRect:fieldBounds cursor:[NSCursor IBeamCursor]]; | |
213 | |
214 // TODO(shess): This needs to traverse the LocationBarDecorations | |
215 // and put up a cursor for them, too. Except for the keyword-search | |
216 // stuff? Sigh. | |
217 // http://crbug.com/48867 | |
218 } | |
219 | |
220 // TODO(shess): -resetFieldEditorFrameIfNeeded is the place where | 207 // TODO(shess): -resetFieldEditorFrameIfNeeded is the place where |
221 // changes to the cell layout should be flushed. LocationBarViewMac | 208 // changes to the cell layout should be flushed. LocationBarViewMac |
222 // and ToolbarController are calling this routine directly, and I | 209 // and ToolbarController are calling this routine directly, and I |
223 // think they are probably wrong. | 210 // think they are probably wrong. |
224 // http://crbug.com/40053 | 211 // http://crbug.com/40053 |
225 - (void)updateCursorAndToolTipRects { | 212 - (void)updateCursorAndToolTipRects { |
226 // This will force |resetCursorRects| to be called, as it is not to be called | 213 // This will force |resetCursorRects| to be called, as it is not to be called |
227 // directly. | 214 // directly. |
228 [[self window] invalidateCursorRectsForView:self]; | 215 [[self window] invalidateCursorRectsForView:self]; |
229 | 216 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { | 392 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { |
406 return [dropHandler_ performDragOperation:sender]; | 393 return [dropHandler_ performDragOperation:sender]; |
407 } | 394 } |
408 | 395 |
409 - (NSMenu*)decorationMenuForEvent:(NSEvent*)event { | 396 - (NSMenu*)decorationMenuForEvent:(NSEvent*)event { |
410 AutocompleteTextFieldCell* cell = [self cell]; | 397 AutocompleteTextFieldCell* cell = [self cell]; |
411 return [cell decorationMenuForEvent:event inRect:[self bounds] ofView:self]; | 398 return [cell decorationMenuForEvent:event inRect:[self bounds] ofView:self]; |
412 } | 399 } |
413 | 400 |
414 @end | 401 @end |
OLD | NEW |