| 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/text_elider.h" | 9 #include "app/text_elider.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // Don't |Attach()| since we don't know the appropriate state; let the | 340 // Don't |Attach()| since we don't know the appropriate state; let the |
| 341 // |SetState()| call do that. | 341 // |SetState()| call do that. |
| 342 | 342 |
| 343 [view setCornerFlags:kRoundedTopRightCorner]; | 343 [view setCornerFlags:kRoundedTopRightCorner]; |
| 344 MouseMoved(gfx::Point(), false); | 344 MouseMoved(gfx::Point(), false); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void StatusBubbleMac::Attach() { | 347 void StatusBubbleMac::Attach() { |
| 348 // This method may be called several times during the process of creating or | 348 // This method may be called several times during the process of creating or |
| 349 // showing a status bubble to attach the bubble to its parent window. | 349 // showing a status bubble to attach the bubble to its parent window. |
| 350 if (!is_attached()) | 350 if (!is_attached()) { |
| 351 [parent_ addChildWindow:window_ ordered:NSWindowAbove]; | 351 [parent_ addChildWindow:window_ ordered:NSWindowAbove]; |
| 352 UpdateSizeAndPosition(); |
| 353 } |
| 352 } | 354 } |
| 353 | 355 |
| 354 void StatusBubbleMac::Detach() { | 356 void StatusBubbleMac::Detach() { |
| 355 // This method may be called several times in the process of hiding or | 357 // This method may be called several times in the process of hiding or |
| 356 // destroying a status bubble. | 358 // destroying a status bubble. |
| 357 if (is_attached()) { | 359 if (is_attached()) { |
| 358 [parent_ removeChildWindow:window_]; // See crbug.com/28107 ... | 360 [parent_ removeChildWindow:window_]; // See crbug.com/28107 ... |
| 359 [window_ orderOut:nil]; // ... and crbug.com/29054. | 361 [window_ orderOut:nil]; // ... and crbug.com/29054. |
| 360 } | 362 } |
| 361 } | 363 } |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 DCHECK(parent_); | 563 DCHECK(parent_); |
| 562 | 564 |
| 563 NSSize size = NSMakeSize(0, kWindowHeight); | 565 NSSize size = NSMakeSize(0, kWindowHeight); |
| 564 size = [[parent_ contentView] convertSize:size toView:nil]; | 566 size = [[parent_ contentView] convertSize:size toView:nil]; |
| 565 | 567 |
| 566 NSRect rect = [parent_ frame]; | 568 NSRect rect = [parent_ frame]; |
| 567 rect.size.height = size.height; | 569 rect.size.height = size.height; |
| 568 rect.size.width = static_cast<int>(kWindowWidthPercent * rect.size.width); | 570 rect.size.width = static_cast<int>(kWindowWidthPercent * rect.size.width); |
| 569 return rect; | 571 return rect; |
| 570 } | 572 } |
| OLD | NEW |