| 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" |
| 11 #import "chrome/browser/cocoa/toolbar_controller.h" | 11 #import "chrome/browser/cocoa/toolbar_controller.h" |
| 12 #import "chrome/browser/cocoa/url_drop_target.h" | 12 #import "chrome/browser/cocoa/url_drop_target.h" |
| 13 #import "chrome/browser/cocoa/view_id_util.h" | 13 #import "chrome/browser/cocoa/view_id_util.h" |
| 14 | 14 |
| 15 @implementation AutocompleteTextField | 15 @implementation AutocompleteTextField |
| 16 | 16 |
| 17 @synthesize observer = observer_; | 17 @synthesize observer = observer_; |
| 18 | 18 |
| 19 + (Class)cellClass { | 19 + (Class)cellClass { |
| 20 return [AutocompleteTextFieldCell class]; | 20 return [AutocompleteTextFieldCell class]; |
| 21 } | 21 } |
| 22 | 22 |
| 23 - (void)dealloc { | 23 - (void)dealloc { |
| 24 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 24 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 25 [super dealloc]; | 25 [super dealloc]; |
| 26 } | 26 } |
| 27 | 27 |
| 28 - (void)awakeFromNib { | 28 - (void)awakeFromNib { |
| 29 DCHECK([[self cell] isKindOfClass:[AutocompleteTextFieldCell class]]); | 29 DCHECK([[self cell] isKindOfClass:[AutocompleteTextFieldCell class]]); |
| 30 [[self cell] setTruncatesLastVisibleLine:YES]; |
| 31 [[self cell] setLineBreakMode:NSLineBreakByTruncatingTail]; |
| 30 currentToolTips_.reset([[NSMutableArray alloc] init]); | 32 currentToolTips_.reset([[NSMutableArray alloc] init]); |
| 31 } | 33 } |
| 32 | 34 |
| 33 - (void)flagsChanged:(NSEvent*)theEvent { | 35 - (void)flagsChanged:(NSEvent*)theEvent { |
| 34 if (observer_) { | 36 if (observer_) { |
| 35 const bool controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0; | 37 const bool controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0; |
| 36 observer_->OnControlKeyChanged(controlFlag); | 38 observer_->OnControlKeyChanged(controlFlag); |
| 37 } | 39 } |
| 38 } | 40 } |
| 39 | 41 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 - (NSMenu*)decorationMenuForEvent:(NSEvent*)event { | 389 - (NSMenu*)decorationMenuForEvent:(NSEvent*)event { |
| 388 AutocompleteTextFieldCell* cell = [self cell]; | 390 AutocompleteTextFieldCell* cell = [self cell]; |
| 389 return [cell decorationMenuForEvent:event inRect:[self bounds] ofView:self]; | 391 return [cell decorationMenuForEvent:event inRect:[self bounds] ofView:self]; |
| 390 } | 392 } |
| 391 | 393 |
| 392 - (ViewID)viewID { | 394 - (ViewID)viewID { |
| 393 return VIEW_ID_LOCATION_BAR; | 395 return VIEW_ID_LOCATION_BAR; |
| 394 } | 396 } |
| 395 | 397 |
| 396 @end | 398 @end |
| OLD | NEW |