| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/toolbar/toolbar_controller.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| 11 #include "base/mac/mac_util.h" | 11 #include "base/mac/mac_util.h" |
| 12 #include "base/mac/sdk_forward_declarations.h" |
| 12 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 13 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "chrome/app/chrome_command_ids.h" | 18 #include "chrome/app/chrome_command_ids.h" |
| 18 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 19 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/command_observer.h" | 21 #include "chrome/browser/command_observer.h" |
| 21 #include "chrome/browser/command_updater.h" | 22 #include "chrome/browser/command_updater.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 115 } |
| 115 | 116 |
| 116 CGFloat BrowserActionsContainerDelegate::GetMaxAllowedWidth() { | 117 CGFloat BrowserActionsContainerDelegate::GetMaxAllowedWidth() { |
| 117 CGFloat location_bar_flex = | 118 CGFloat location_bar_flex = |
| 118 NSWidth([location_bar_ frame]) - kMinimumLocationBarWidth; | 119 NSWidth([location_bar_ frame]) - kMinimumLocationBarWidth; |
| 119 return NSWidth([browser_actions_container_ frame]) + location_bar_flex; | 120 return NSWidth([browser_actions_container_ frame]) + location_bar_flex; |
| 120 } | 121 } |
| 121 | 122 |
| 122 } // namespace | 123 } // namespace |
| 123 | 124 |
| 124 @interface ToolbarController (YosemiteSDK) | |
| 125 - (void)viewDidLoad; | |
| 126 @end | |
| 127 | |
| 128 @interface ToolbarController() | 125 @interface ToolbarController() |
| 129 @property(assign, nonatomic) Browser* browser; | 126 @property(assign, nonatomic) Browser* browser; |
| 130 - (void)cleanUp; | 127 - (void)cleanUp; |
| 131 - (void)addAccessibilityDescriptions; | 128 - (void)addAccessibilityDescriptions; |
| 132 - (void)initCommandStatus:(CommandUpdater*)commands; | 129 - (void)initCommandStatus:(CommandUpdater*)commands; |
| 133 - (void)prefChanged:(const std::string&)prefName; | 130 - (void)prefChanged:(const std::string&)prefName; |
| 134 - (BackgroundGradientView*)backgroundGradientView; | 131 - (BackgroundGradientView*)backgroundGradientView; |
| 135 - (void)toolbarFrameChanged; | 132 - (void)toolbarFrameChanged; |
| 136 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate; | 133 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate; |
| 137 - (void)maintainMinimumLocationBarWidth; | 134 - (void)maintainMinimumLocationBarWidth; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // reason is not guaranteed to be called (http://crbug.com/526276), so implement | 255 // reason is not guaranteed to be called (http://crbug.com/526276), so implement |
| 259 // both. | 256 // both. |
| 260 - (void)awakeFromNib { | 257 - (void)awakeFromNib { |
| 261 [self viewDidLoad]; | 258 [self viewDidLoad]; |
| 262 } | 259 } |
| 263 | 260 |
| 264 - (void)viewDidLoad { | 261 - (void)viewDidLoad { |
| 265 // When linking and running on 10.10+, both -awakeFromNib and -viewDidLoad may | 262 // When linking and running on 10.10+, both -awakeFromNib and -viewDidLoad may |
| 266 // be called, don't initialize twice. | 263 // be called, don't initialize twice. |
| 267 if (locationBarView_) { | 264 if (locationBarView_) { |
| 268 #if defined(MAC_OS_X_VERSION_10_10) && \ | |
| 269 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10 | |
| 270 DCHECK(base::mac::IsOSYosemiteOrLater()); | 265 DCHECK(base::mac::IsOSYosemiteOrLater()); |
| 271 #else | |
| 272 NOTREACHED(); | |
| 273 #endif | |
| 274 return; | 266 return; |
| 275 } | 267 } |
| 276 | 268 |
| 277 [[backButton_ cell] setImageID:IDR_BACK | 269 [[backButton_ cell] setImageID:IDR_BACK |
| 278 forButtonState:image_button_cell::kDefaultState]; | 270 forButtonState:image_button_cell::kDefaultState]; |
| 279 [[backButton_ cell] setImageID:IDR_BACK_H | 271 [[backButton_ cell] setImageID:IDR_BACK_H |
| 280 forButtonState:image_button_cell::kHoverState]; | 272 forButtonState:image_button_cell::kHoverState]; |
| 281 [[backButton_ cell] setImageID:IDR_BACK_P | 273 [[backButton_ cell] setImageID:IDR_BACK_P |
| 282 forButtonState:image_button_cell::kPressedState]; | 274 forButtonState:image_button_cell::kPressedState]; |
| 283 [[backButton_ cell] setImageID:IDR_BACK_D | 275 [[backButton_ cell] setImageID:IDR_BACK_D |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 950 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 959 // Do nothing. | 951 // Do nothing. |
| 960 } | 952 } |
| 961 | 953 |
| 962 // (URLDropTargetController protocol) | 954 // (URLDropTargetController protocol) |
| 963 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 955 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
| 964 return drag_util::IsUnsupportedDropData(profile_, info); | 956 return drag_util::IsUnsupportedDropData(profile_, info); |
| 965 } | 957 } |
| 966 | 958 |
| 967 @end | 959 @end |
| OLD | NEW |