| 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 #include "chrome/browser/ui/panels/panel_window_controller_cocoa.h" | 5 #include "chrome/browser/ui/panels/panel_window_controller_cocoa.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 [boundsAnimation_ release]; | 855 [boundsAnimation_ release]; |
| 856 boundsAnimation_ = nil; | 856 boundsAnimation_ = nil; |
| 857 } | 857 } |
| 858 | 858 |
| 859 - (BOOL)isAnimatingBounds { | 859 - (BOOL)isAnimatingBounds { |
| 860 return boundsAnimation_ && [boundsAnimation_ isAnimating]; | 860 return boundsAnimation_ && [boundsAnimation_ isAnimating]; |
| 861 } | 861 } |
| 862 | 862 |
| 863 - (void)onTitlebarMouseClicked:(int)modifierFlags { | 863 - (void)onTitlebarMouseClicked:(int)modifierFlags { |
| 864 Panel* panel = windowShim_->panel(); | 864 Panel* panel = windowShim_->panel(); |
| 865 if (modifierFlags & NSShiftKeyMask) { | 865 panel->OnTitlebarClicked((modifierFlags & NSShiftKeyMask) ? |
| 866 panel->OnTitlebarClicked(panel::APPLY_TO_ALL); | 866 panel::APPLY_TO_ALL : panel::NO_MODIFIER); |
| 867 return; | |
| 868 } | |
| 869 | |
| 870 // TODO(jennb): Move remaining titlebar click handling out of here. | |
| 871 // (http://crbug.com/118431) | |
| 872 PanelStrip* panelStrip = panel->panel_strip(); | |
| 873 if (!panelStrip) | |
| 874 return; | |
| 875 if (panelStrip->type() == PanelStrip::DOCKED && | |
| 876 panel->expansion_state() == Panel::EXPANDED) { | |
| 877 if ([[self titlebarView] isDrawingAttention]) { | |
| 878 // Do not minimize if the Panel is drawing attention since user | |
| 879 // most likely simply wants to reset the 'draw attention' status. | |
| 880 panel->Activate(); | |
| 881 return; | |
| 882 } | |
| 883 panel->SetExpansionState(Panel::MINIMIZED); | |
| 884 // The Panel class ensures deactivation when it is minimized. | |
| 885 } else { | |
| 886 panel->Activate(); | |
| 887 } | |
| 888 } | 867 } |
| 889 | 868 |
| 890 - (int)titlebarHeightInScreenCoordinates { | 869 - (int)titlebarHeightInScreenCoordinates { |
| 891 NSView* titlebar = [self titlebarView]; | 870 NSView* titlebar = [self titlebarView]; |
| 892 return NSHeight([titlebar convertRect:[titlebar bounds] toView:nil]); | 871 return NSHeight([titlebar convertRect:[titlebar bounds] toView:nil]); |
| 893 } | 872 } |
| 894 | 873 |
| 895 - (int)titlebarIconOnlyWidthInScreenCoordinates { | 874 - (int)titlebarIconOnlyWidthInScreenCoordinates { |
| 896 return [[self titlebarView] iconOnlyWidthInScreenCoordinates]; | 875 return [[self titlebarView] iconOnlyWidthInScreenCoordinates]; |
| 897 } | 876 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 if (![self isWindowLoaded]) | 1013 if (![self isWindowLoaded]) |
| 1035 return; | 1014 return; |
| 1036 [[self window] invalidateCursorRectsForView:overlayView_]; | 1015 [[self window] invalidateCursorRectsForView:overlayView_]; |
| 1037 } | 1016 } |
| 1038 | 1017 |
| 1039 - (BOOL)isActivationByClickingTitlebarEnabled { | 1018 - (BOOL)isActivationByClickingTitlebarEnabled { |
| 1040 return !windowShim_->panel()->always_on_top(); | 1019 return !windowShim_->panel()->always_on_top(); |
| 1041 } | 1020 } |
| 1042 | 1021 |
| 1043 @end | 1022 @end |
| OLD | NEW |