| 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" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 - (CGFloat)baseToolbarHeight; | 153 - (CGFloat)baseToolbarHeight; |
| 154 - (void)toolbarFrameChanged; | 154 - (void)toolbarFrameChanged; |
| 155 - (void)showLocationBarOnly; | 155 - (void)showLocationBarOnly; |
| 156 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate; | 156 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate; |
| 157 - (void)maintainMinimumLocationBarWidth; | 157 - (void)maintainMinimumLocationBarWidth; |
| 158 - (void)adjustBrowserActionsContainerForNewWindow:(NSNotification*)notification; | 158 - (void)adjustBrowserActionsContainerForNewWindow:(NSNotification*)notification; |
| 159 - (void)browserActionsContainerDragged:(NSNotification*)notification; | 159 - (void)browserActionsContainerDragged:(NSNotification*)notification; |
| 160 - (void)browserActionsVisibilityChanged:(NSNotification*)notification; | 160 - (void)browserActionsVisibilityChanged:(NSNotification*)notification; |
| 161 - (void)browserActionsContainerWillAnimate:(NSNotification*)notification; | 161 - (void)browserActionsContainerWillAnimate:(NSNotification*)notification; |
| 162 - (void)adjustLocationSizeBy:(CGFloat)dX animate:(BOOL)animate; | 162 - (void)adjustLocationSizeBy:(CGFloat)dX animate:(BOOL)animate; |
| 163 - (void)updateAppMenuButtonSeverity:(AppMenuIconPainter::Severity)severity | 163 - (void)updateAppMenuButtonSeverity:(AppMenuIconController::Severity)severity |
| 164 iconType:(AppMenuIconController::IconType)iconType | 164 iconType:(AppMenuIconController::IconType)iconType |
| 165 animate:(BOOL)animate; | 165 animate:(BOOL)animate; |
| 166 @end | 166 @end |
| 167 | 167 |
| 168 namespace ToolbarControllerInternal { | 168 namespace ToolbarControllerInternal { |
| 169 | 169 |
| 170 // A C++ bridge class that handles listening for updates to commands and | 170 // A C++ bridge class that handles listening for updates to commands and |
| 171 // passing them back to ToolbarController. ToolbarController will create one of | 171 // passing them back to ToolbarController. ToolbarController will create one of |
| 172 // these bridges, pass them to CommandUpdater::AddCommandObserver, and then wait | 172 // these bridges, pass them to CommandUpdater::AddCommandObserver, and then wait |
| 173 // for update notifications, delivered via | 173 // for update notifications, delivered via |
| (...skipping 23 matching lines...) Expand all Loading... |
| 197 class NotificationBridge : public AppMenuIconController::Delegate { | 197 class NotificationBridge : public AppMenuIconController::Delegate { |
| 198 public: | 198 public: |
| 199 explicit NotificationBridge(ToolbarController* controller) | 199 explicit NotificationBridge(ToolbarController* controller) |
| 200 : controller_(controller), | 200 : controller_(controller), |
| 201 app_menu_icon_controller_([controller browser]->profile(), this) {} | 201 app_menu_icon_controller_([controller browser]->profile(), this) {} |
| 202 ~NotificationBridge() override {} | 202 ~NotificationBridge() override {} |
| 203 | 203 |
| 204 void UpdateSeverity() { app_menu_icon_controller_.UpdateDelegate(); } | 204 void UpdateSeverity() { app_menu_icon_controller_.UpdateDelegate(); } |
| 205 | 205 |
| 206 void UpdateSeverity(AppMenuIconController::IconType type, | 206 void UpdateSeverity(AppMenuIconController::IconType type, |
| 207 AppMenuIconPainter::Severity severity, | 207 AppMenuIconController::Severity severity, |
| 208 bool animate) override { | 208 bool animate) override { |
| 209 [controller_ updateAppMenuButtonSeverity:severity | 209 [controller_ updateAppMenuButtonSeverity:severity |
| 210 iconType:type | 210 iconType:type |
| 211 animate:animate]; | 211 animate:animate]; |
| 212 } | 212 } |
| 213 | 213 |
| 214 void OnPreferenceChanged(const std::string& pref_name) { | 214 void OnPreferenceChanged(const std::string& pref_name) { |
| 215 [controller_ prefChanged:pref_name]; | 215 [controller_ prefChanged:pref_name]; |
| 216 } | 216 } |
| 217 | 217 |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 - (void)installAppMenu { | 751 - (void)installAppMenu { |
| 752 if (appMenuController_.get()) | 752 if (appMenuController_.get()) |
| 753 return; | 753 return; |
| 754 | 754 |
| 755 appMenuController_.reset( | 755 appMenuController_.reset( |
| 756 [[AppMenuController alloc] initWithBrowser:browser_]); | 756 [[AppMenuController alloc] initWithBrowser:browser_]); |
| 757 [appMenuController_ setUseWithPopUpButtonCell:YES]; | 757 [appMenuController_ setUseWithPopUpButtonCell:YES]; |
| 758 [appMenuButton_ setAttachedMenu:[appMenuController_ menu]]; | 758 [appMenuButton_ setAttachedMenu:[appMenuController_ menu]]; |
| 759 } | 759 } |
| 760 | 760 |
| 761 - (void)updateAppMenuButtonSeverity:(AppMenuIconPainter::Severity)severity | 761 - (void)updateAppMenuButtonSeverity:(AppMenuIconController::Severity)severity |
| 762 iconType:(AppMenuIconController::IconType)iconType | 762 iconType:(AppMenuIconController::IconType)iconType |
| 763 animate:(BOOL)animate { | 763 animate:(BOOL)animate { |
| 764 AppToolbarButton* appMenuButton = | 764 AppToolbarButton* appMenuButton = |
| 765 base::mac::ObjCCastStrict<AppToolbarButton>(appMenuButton_); | 765 base::mac::ObjCCastStrict<AppToolbarButton>(appMenuButton_); |
| 766 [appMenuButton setSeverity:severity iconType:iconType shouldAnimate:animate]; | 766 [appMenuButton setSeverity:severity iconType:iconType shouldAnimate:animate]; |
| 767 } | 767 } |
| 768 | 768 |
| 769 - (void)prefChanged:(const std::string&)prefName { | 769 - (void)prefChanged:(const std::string&)prefName { |
| 770 if (prefName == prefs::kShowHomeButton) { | 770 if (prefName == prefs::kShowHomeButton) { |
| 771 [self showOptionalHomeButton]; | 771 [self showOptionalHomeButton]; |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 1087 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 1088 // Do nothing. | 1088 // Do nothing. |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 // (URLDropTargetController protocol) | 1091 // (URLDropTargetController protocol) |
| 1092 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 1092 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
| 1093 return drag_util::IsUnsupportedDropData(profile_, info); | 1093 return drag_util::IsUnsupportedDropData(profile_, info); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 @end | 1096 @end |
| OLD | NEW |