| 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" |
| 11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 12 #include "chrome/browser/ui/cocoa/l10n_util.h" |
| 12 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" | 13 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
| 13 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" | 14 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" |
| 14 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" | 15 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" |
| 15 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 16 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
| 16 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 17 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 17 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 18 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
| 18 #import "chrome/browser/ui/cocoa/view_id_util.h" | 19 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 19 #import "ui/base/cocoa/nsview_additions.h" | 20 #import "ui/base/cocoa/nsview_additions.h" |
| 20 #include "ui/base/material_design/material_design_controller.h" | 21 #include "ui/base/material_design/material_design_controller.h" |
| 21 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 22 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 39 } | 40 } |
| 40 | 41 |
| 41 - (void)awakeFromNib { | 42 - (void)awakeFromNib { |
| 42 DCHECK([[self cell] isKindOfClass:[AutocompleteTextFieldCell class]]); | 43 DCHECK([[self cell] isKindOfClass:[AutocompleteTextFieldCell class]]); |
| 43 [[self cell] setTruncatesLastVisibleLine:YES]; | 44 [[self cell] setTruncatesLastVisibleLine:YES]; |
| 44 [[self cell] setLineBreakMode:NSLineBreakByTruncatingTail]; | 45 [[self cell] setLineBreakMode:NSLineBreakByTruncatingTail]; |
| 45 currentToolTips_.reset([[NSMutableArray alloc] init]); | 46 currentToolTips_.reset([[NSMutableArray alloc] init]); |
| 46 resizeAnimation_.reset([[NSViewAnimation alloc] init]); | 47 resizeAnimation_.reset([[NSViewAnimation alloc] init]); |
| 47 [resizeAnimation_ setDuration:kAnimationDuration]; | 48 [resizeAnimation_ setDuration:kAnimationDuration]; |
| 48 [resizeAnimation_ setAnimationBlockingMode:NSAnimationNonblocking]; | 49 [resizeAnimation_ setAnimationBlockingMode:NSAnimationNonblocking]; |
| 50 [self setAlignment:cocoa_l10n_util::ShouldDoExperimentalRTLLayout() |
| 51 ? NSRightTextAlignment |
| 52 : NSLeftTextAlignment]; |
| 49 | 53 |
| 50 // Disable Force Touch in the Omnibox. Note that this API is defined in | 54 // Disable Force Touch in the Omnibox. Note that this API is defined in |
| 51 // 10.10.3 and higher so have to check more than just isYosmiteOrLater(). | 55 // 10.10.3 and higher so have to check more than just isYosmiteOrLater(). |
| 52 // Also, because NSPressureConfiguration is not in the original 10.10 SDK, | 56 // Also, because NSPressureConfiguration is not in the original 10.10 SDK, |
| 53 // use NSClassFromString() to instantiate it (otherwise there's a | 57 // use NSClassFromString() to instantiate it (otherwise there's a |
| 54 // linker error). | 58 // linker error). |
| 55 if (base::mac::IsAtLeastOS10_10() && | 59 if (base::mac::IsAtLeastOS10_10() && |
| 56 [self respondsToSelector:@selector(setPressureConfiguration:)]) { | 60 [self respondsToSelector:@selector(setPressureConfiguration:)]) { |
| 57 NSPressureConfiguration* pressureConfiguration = | 61 NSPressureConfiguration* pressureConfiguration = |
| 58 [[[NSClassFromString(@"NSPressureConfiguration") alloc] | 62 [[[NSClassFromString(@"NSPressureConfiguration") alloc] |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 // ThemedWindowDrawing implementation. | 549 // ThemedWindowDrawing implementation. |
| 546 | 550 |
| 547 - (void)windowDidChangeTheme { | 551 - (void)windowDidChangeTheme { |
| 548 [self updateColorsToMatchTheme]; | 552 [self updateColorsToMatchTheme]; |
| 549 } | 553 } |
| 550 | 554 |
| 551 - (void)windowDidChangeActive { | 555 - (void)windowDidChangeActive { |
| 552 } | 556 } |
| 553 | 557 |
| 554 @end | 558 @end |
| OLD | NEW |