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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 // Set a delegate for the fade-in and fade-out transitions to be notified | 391 // Set a delegate for the fade-in and fade-out transitions to be notified |
392 // when fades are complete. The ownership model is for window_ to own | 392 // when fades are complete. The ownership model is for window_ to own |
393 // animation_dictionary, which owns animation, which owns | 393 // animation_dictionary, which owns animation, which owns |
394 // animation_delegate. | 394 // animation_delegate. |
395 CAAnimation* animation = [[window_ animationForKey:kFadeAnimationKey] copy]; | 395 CAAnimation* animation = [[window_ animationForKey:kFadeAnimationKey] copy]; |
396 [animation autorelease]; | 396 [animation autorelease]; |
397 StatusBubbleAnimationDelegate* animation_delegate = | 397 StatusBubbleAnimationDelegate* animation_delegate = |
398 [[StatusBubbleAnimationDelegate alloc] initWithStatusBubble:this]; | 398 [[StatusBubbleAnimationDelegate alloc] initWithStatusBubble:this]; |
399 [animation_delegate autorelease]; | 399 [animation_delegate autorelease]; |
400 [animation setDelegate:animation_delegate]; | 400 [animation setDelegate:animation_delegate]; |
401 base::scoped_nsobject<NSMutableDictionary> animation_dictionary( | 401 NSMutableDictionary* animation_dictionary = |
402 [[window_ animations] mutableCopy]); | 402 [NSMutableDictionary dictionaryWithDictionary:[window_ animations]]; |
403 [animation_dictionary.get() setObject:animation forKey:kFadeAnimationKey]; | 403 [animation_dictionary setObject:animation forKey:kFadeAnimationKey]; |
404 [window_ setAnimations:animation_dictionary.get()]; | 404 [window_ setAnimations:animation_dictionary]; |
405 | 405 |
406 [view setCornerFlags:kRoundedTopRightCorner]; | 406 [view setCornerFlags:kRoundedTopRightCorner]; |
407 MouseMoved(gfx::Point(), false); | 407 MouseMoved(gfx::Point(), false); |
408 } | 408 } |
409 | 409 |
410 void StatusBubbleMac::Attach() { | 410 void StatusBubbleMac::Attach() { |
411 DCHECK(!is_attached()); | 411 DCHECK(!is_attached()); |
412 | 412 |
413 [window_ orderFront:nil]; | 413 [window_ orderFront:nil]; |
414 [parent_ addChildWindow:window_ ordered:NSWindowAbove]; | 414 [parent_ addChildWindow:window_ ordered:NSWindowAbove]; |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 } | 744 } |
745 | 745 |
746 // Round the top corners when the bubble is below the parent window. | 746 // Round the top corners when the bubble is below the parent window. |
747 if (NSMinY(window_frame) < NSMinY(parent_frame)) { | 747 if (NSMinY(window_frame) < NSMinY(parent_frame)) { |
748 corner_flags |= kRoundedTopLeftCorner | kRoundedTopRightCorner; | 748 corner_flags |= kRoundedTopLeftCorner | kRoundedTopRightCorner; |
749 } | 749 } |
750 } | 750 } |
751 | 751 |
752 return corner_flags; | 752 return corner_flags; |
753 } | 753 } |
OLD | NEW |