| 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/cocoa/status_bubble_mac.h" | 5 #include "chrome/browser/ui/cocoa/status_bubble_mac.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // How close the mouse can get to the infobubble before it starts sliding | 39 // How close the mouse can get to the infobubble before it starts sliding |
| 40 // off-screen. | 40 // off-screen. |
| 41 const int kMousePadding = 20; | 41 const int kMousePadding = 20; |
| 42 | 42 |
| 43 const int kTextPadding = 3; | 43 const int kTextPadding = 3; |
| 44 | 44 |
| 45 // The status bubble's maximum opacity, when fully faded in. | 45 // The status bubble's maximum opacity, when fully faded in. |
| 46 const CGFloat kBubbleOpacity = 1.0; | 46 const CGFloat kBubbleOpacity = 1.0; |
| 47 | 47 |
| 48 // Delay before showing or hiding the bubble after a SetStatus or SetURL call. | 48 // Delay before showing or hiding the bubble after a SetStatus or SetURL call. |
| 49 const int64 kShowDelayMS = 80; | 49 const int64_t kShowDelayMS = 80; |
| 50 const int64 kHideDelayMS = 250; | 50 const int64_t kHideDelayMS = 250; |
| 51 | 51 |
| 52 // How long each fade should last. | 52 // How long each fade should last. |
| 53 const NSTimeInterval kShowFadeInDurationSeconds = 0.120; | 53 const NSTimeInterval kShowFadeInDurationSeconds = 0.120; |
| 54 const NSTimeInterval kHideFadeOutDurationSeconds = 0.200; | 54 const NSTimeInterval kHideFadeOutDurationSeconds = 0.200; |
| 55 | 55 |
| 56 // The minimum representable time interval. This can be used as the value | 56 // The minimum representable time interval. This can be used as the value |
| 57 // passed to +[NSAnimationContext setDuration:] to stop an in-progress | 57 // passed to +[NSAnimationContext setDuration:] to stop an in-progress |
| 58 // animation as quickly as possible. | 58 // animation as quickly as possible. |
| 59 const NSTimeInterval kMinimumTimeInterval = | 59 const NSTimeInterval kMinimumTimeInterval = |
| 60 std::numeric_limits<NSTimeInterval>::min(); | 60 std::numeric_limits<NSTimeInterval>::min(); |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 runAnimationGroup:^(NSAnimationContext* context) { | 588 runAnimationGroup:^(NSAnimationContext* context) { |
| 589 [context setDuration:duration]; | 589 [context setDuration:duration]; |
| 590 [[window_ animator] setAlphaValue:alpha]; | 590 [[window_ animator] setAlphaValue:alpha]; |
| 591 } | 591 } |
| 592 completionHandler:^{ | 592 completionHandler:^{ |
| 593 if (weak_ptr) | 593 if (weak_ptr) |
| 594 weak_ptr->AnimationDidStop(); | 594 weak_ptr->AnimationDidStop(); |
| 595 }]; | 595 }]; |
| 596 } | 596 } |
| 597 | 597 |
| 598 void StatusBubbleMac::StartTimer(int64 delay_ms) { | 598 void StatusBubbleMac::StartTimer(int64_t delay_ms) { |
| 599 DCHECK([NSThread isMainThread]); | 599 DCHECK([NSThread isMainThread]); |
| 600 DCHECK(state_ == kBubbleShowingTimer || state_ == kBubbleHidingTimer); | 600 DCHECK(state_ == kBubbleShowingTimer || state_ == kBubbleHidingTimer); |
| 601 | 601 |
| 602 if (immediate_) { | 602 if (immediate_) { |
| 603 TimerFired(); | 603 TimerFired(); |
| 604 return; | 604 return; |
| 605 } | 605 } |
| 606 | 606 |
| 607 // There can only be one running timer. | 607 // There can only be one running timer. |
| 608 CancelTimer(); | 608 CancelTimer(); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 } | 849 } |
| 850 | 850 |
| 851 // Round the top corners when the bubble is below the parent window. | 851 // Round the top corners when the bubble is below the parent window. |
| 852 if (NSMinY(window_frame) < NSMinY(parent_frame)) { | 852 if (NSMinY(window_frame) < NSMinY(parent_frame)) { |
| 853 corner_flags |= kRoundedTopLeftCorner | kRoundedTopRightCorner; | 853 corner_flags |= kRoundedTopLeftCorner | kRoundedTopRightCorner; |
| 854 } | 854 } |
| 855 } | 855 } |
| 856 | 856 |
| 857 return corner_flags; | 857 return corner_flags; |
| 858 } | 858 } |
| OLD | NEW |