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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 DCHECK_EQ([[window_ animator] alphaValue], 0.0); | 440 DCHECK_EQ([[window_ animator] alphaValue], 0.0); |
441 SetState(kBubbleHidden); | 441 SetState(kBubbleHidden); |
442 } | 442 } |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 void StatusBubbleMac::SetState(StatusBubbleState state) { | 446 void StatusBubbleMac::SetState(StatusBubbleState state) { |
447 if (state == state_) | 447 if (state == state_) |
448 return; | 448 return; |
449 | 449 |
450 if (state == kBubbleHidden) | 450 if (state == kBubbleHidden) { |
451 [window_ setFrame:NSMakeRect(0, 0, 1, 1) display:YES]; | 451 NSRect frame = [window_ frame]; |
sail
2012/04/23 19:28:07
can you add a comment explaining this (for example
Alexei Svitkine (slow)
2012/04/23 19:43:57
Done.
| |
452 frame.size = NSMakeSize(1, 1); | |
453 [window_ setFrame:frame display:YES]; | |
454 } | |
452 | 455 |
453 if ([delegate_ respondsToSelector:@selector(statusBubbleWillEnterState:)]) | 456 if ([delegate_ respondsToSelector:@selector(statusBubbleWillEnterState:)]) |
454 [delegate_ statusBubbleWillEnterState:state]; | 457 [delegate_ statusBubbleWillEnterState:state]; |
455 | 458 |
456 state_ = state; | 459 state_ = state; |
457 } | 460 } |
458 | 461 |
459 void StatusBubbleMac::Fade(bool show) { | 462 void StatusBubbleMac::Fade(bool show) { |
460 DCHECK([NSThread isMainThread]); | 463 DCHECK([NSThread isMainThread]); |
461 | 464 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
730 } | 733 } |
731 | 734 |
732 // Round the top corners when the bubble is below the parent window. | 735 // Round the top corners when the bubble is below the parent window. |
733 if (NSMinY(window_frame) < NSMinY(parent_frame)) { | 736 if (NSMinY(window_frame) < NSMinY(parent_frame)) { |
734 corner_flags |= kRoundedTopLeftCorner | kRoundedTopRightCorner; | 737 corner_flags |= kRoundedTopLeftCorner | kRoundedTopRightCorner; |
735 } | 738 } |
736 } | 739 } |
737 | 740 |
738 return corner_flags; | 741 return corner_flags; |
739 } | 742 } |
OLD | NEW |