OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/cocoa/status_bubble_mac.h" | 5 #include "chrome/browser/cocoa/status_bubble_mac.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "app/gfx/text_elider.h" | 9 #include "app/gfx/text_elider.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 NSTimeInterval duration = | 424 NSTimeInterval duration = |
425 full_duration * | 425 full_duration * |
426 fabs(opacity - [[window_ animator] alphaValue]) / kBubbleOpacity; | 426 fabs(opacity - [[window_ animator] alphaValue]) / kBubbleOpacity; |
427 | 427 |
428 // 0.0 will not cancel an in-progress animation. | 428 // 0.0 will not cancel an in-progress animation. |
429 if (duration == 0.0) | 429 if (duration == 0.0) |
430 duration = kMinimumTimeInterval; | 430 duration = kMinimumTimeInterval; |
431 | 431 |
432 // This will cancel an in-progress transition and replace it with this fade. | 432 // This will cancel an in-progress transition and replace it with this fade. |
433 [NSAnimationContext beginGrouping]; | 433 [NSAnimationContext beginGrouping]; |
434 [[NSAnimationContext currentContext] gtm_setDuration:duration]; | 434 [[NSAnimationContext currentContext] gtm_setDuration:duration |
| 435 eventMask:NSLeftMouseDownMask]; |
435 [[window_ animator] setAlphaValue:opacity]; | 436 [[window_ animator] setAlphaValue:opacity]; |
436 [NSAnimationContext endGrouping]; | 437 [NSAnimationContext endGrouping]; |
437 } | 438 } |
438 | 439 |
439 void StatusBubbleMac::StartTimer(int64 delay_ms) { | 440 void StatusBubbleMac::StartTimer(int64 delay_ms) { |
440 DCHECK([NSThread isMainThread]); | 441 DCHECK([NSThread isMainThread]); |
441 DCHECK(state_ == kBubbleShowingTimer || state_ == kBubbleHidingTimer); | 442 DCHECK(state_ == kBubbleShowingTimer || state_ == kBubbleHidingTimer); |
442 | 443 |
443 if (immediate_) { | 444 if (immediate_) { |
444 TimerFired(); | 445 TimerFired(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 552 } |
552 | 553 |
553 NSRect StatusBubbleMac::CalculateWindowFrame() { | 554 NSRect StatusBubbleMac::CalculateWindowFrame() { |
554 DCHECK(parent_); | 555 DCHECK(parent_); |
555 | 556 |
556 NSRect rect = [parent_ frame]; | 557 NSRect rect = [parent_ frame]; |
557 rect.size.height = kWindowHeight; | 558 rect.size.height = kWindowHeight; |
558 rect.size.width = static_cast<int>(kWindowWidthPercent * rect.size.width); | 559 rect.size.width = static_cast<int>(kWindowWidthPercent * rect.size.width); |
559 return rect; | 560 return rect; |
560 } | 561 } |
OLD | NEW |