| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 void StatusBubbleMac::Attach() { | 343 void StatusBubbleMac::Attach() { |
| 344 // This method may be called several times during the process of creating or | 344 // This method may be called several times during the process of creating or |
| 345 // showing a status bubble to attach the bubble to its parent window. | 345 // showing a status bubble to attach the bubble to its parent window. |
| 346 if (!is_attached()) | 346 if (!is_attached()) |
| 347 [parent_ addChildWindow:window_ ordered:NSWindowAbove]; | 347 [parent_ addChildWindow:window_ ordered:NSWindowAbove]; |
| 348 } | 348 } |
| 349 | 349 |
| 350 void StatusBubbleMac::Detach() { | 350 void StatusBubbleMac::Detach() { |
| 351 // This method may be called several times in the process of hiding or | 351 // This method may be called several times in the process of hiding or |
| 352 // destroying a status bubble. | 352 // destroying a status bubble. |
| 353 if (is_attached()) | 353 if (is_attached()) { |
| 354 [parent_ removeChildWindow:window_]; | 354 [parent_ removeChildWindow:window_]; // See crbug.com/28107 ... |
| 355 [window_ orderOut:nil]; // ... and crbug.com/29054. |
| 356 } |
| 355 } | 357 } |
| 356 | 358 |
| 357 void StatusBubbleMac::AnimationDidStop(CAAnimation* animation, bool finished) { | 359 void StatusBubbleMac::AnimationDidStop(CAAnimation* animation, bool finished) { |
| 358 DCHECK([NSThread isMainThread]); | 360 DCHECK([NSThread isMainThread]); |
| 359 DCHECK(state_ == kBubbleShowingFadeIn || state_ == kBubbleHidingFadeOut); | 361 DCHECK(state_ == kBubbleShowingFadeIn || state_ == kBubbleHidingFadeOut); |
| 360 DCHECK(is_attached()); | 362 DCHECK(is_attached()); |
| 361 | 363 |
| 362 if (finished) { | 364 if (finished) { |
| 363 // Because of the mechanism used to interrupt animations, this is never | 365 // Because of the mechanism used to interrupt animations, this is never |
| 364 // actually called with finished set to false. If animations ever become | 366 // actually called with finished set to false. If animations ever become |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 } | 534 } |
| 533 | 535 |
| 534 NSRect StatusBubbleMac::CalculateWindowFrame() { | 536 NSRect StatusBubbleMac::CalculateWindowFrame() { |
| 535 DCHECK(parent_); | 537 DCHECK(parent_); |
| 536 | 538 |
| 537 NSRect rect = [parent_ frame]; | 539 NSRect rect = [parent_ frame]; |
| 538 rect.size.height = kWindowHeight; | 540 rect.size.height = kWindowHeight; |
| 539 rect.size.width = static_cast<int>(kWindowWidthPercent * rect.size.width); | 541 rect.size.width = static_cast<int>(kWindowWidthPercent * rect.size.width); |
| 540 return rect; | 542 return rect; |
| 541 } | 543 } |
| OLD | NEW |