| 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 #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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 // Initialize animation differently in this case, using fast-pause-slow | 461 // Initialize animation differently in this case, using fast-pause-slow |
| 462 // method, see below for more details. | 462 // method, see below for more details. |
| 463 if (windowShim_->panel()->expansion_state() == Panel::MINIMIZED) { | 463 if (windowShim_->panel()->expansion_state() == Panel::MINIMIZED) { |
| 464 animationStopToShowTitlebarOnly_ = | 464 animationStopToShowTitlebarOnly_ = |
| 465 1.0 - (windowShim_->TitleOnlyHeight() - NSHeight(frame)) / distanceY; | 465 1.0 - (windowShim_->TitleOnlyHeight() - NSHeight(frame)) / distanceY; |
| 466 if (animationStopToShowTitlebarOnly_ > 0.7) { // Relatively big movement. | 466 if (animationStopToShowTitlebarOnly_ > 0.7) { // Relatively big movement. |
| 467 playingMinimizeAnimation_ = YES; | 467 playingMinimizeAnimation_ = YES; |
| 468 duration = 1.5; | 468 duration = 1.5; |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 [boundsAnimation_ setDuration: duration]; | 471 [boundsAnimation_ setDuration: PanelManager::AdjustTimeInterval(duration)]; |
| 472 [boundsAnimation_ setFrameRate:0.0]; | 472 [boundsAnimation_ setFrameRate:0.0]; |
| 473 [boundsAnimation_ setAnimationBlockingMode: NSAnimationNonblocking]; | 473 [boundsAnimation_ setAnimationBlockingMode: NSAnimationNonblocking]; |
| 474 [boundsAnimation_ startAnimation]; | 474 [boundsAnimation_ startAnimation]; |
| 475 } | 475 } |
| 476 | 476 |
| 477 - (float)animation:(NSAnimation*)animation | 477 - (float)animation:(NSAnimation*)animation |
| 478 valueForProgress:(NSAnimationProgress)progress { | 478 valueForProgress:(NSAnimationProgress)progress { |
| 479 return PanelSlideAnimation::ComputeAnimationValue( | 479 return PanelSlideAnimation::ComputeAnimationValue( |
| 480 progress, playingMinimizeAnimation_, animationStopToShowTitlebarOnly_); | 480 progress, playingMinimizeAnimation_, animationStopToShowTitlebarOnly_); |
| 481 } | 481 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 - (BOOL)canBecomeKeyWindow { | 597 - (BOOL)canBecomeKeyWindow { |
| 598 // Panel can only gain focus if it is expanded. Minimized panels do not | 598 // Panel can only gain focus if it is expanded. Minimized panels do not |
| 599 // participate in Cmd-~ rotation. | 599 // participate in Cmd-~ rotation. |
| 600 // TODO(dimich): If it will be ever desired to expand/focus the Panel on | 600 // TODO(dimich): If it will be ever desired to expand/focus the Panel on |
| 601 // keyboard navigation or via main menu, the care should be taken to avoid | 601 // keyboard navigation or via main menu, the care should be taken to avoid |
| 602 // cases when minimized Panel is getting keyboard input, invisibly. | 602 // cases when minimized Panel is getting keyboard input, invisibly. |
| 603 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; | 603 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; |
| 604 } | 604 } |
| 605 | 605 |
| 606 @end | 606 @end |
| OLD | NEW |