| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 SetFrameAvoidingMouse([window_ frame], location); | 345 SetFrameAvoidingMouse([window_ frame], location); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void StatusBubbleMac::UpdateDownloadShelfVisibility(bool visible) { | 348 void StatusBubbleMac::UpdateDownloadShelfVisibility(bool visible) { |
| 349 UpdateSizeAndPosition(); | 349 UpdateSizeAndPosition(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void StatusBubbleMac::Create() { | 352 void StatusBubbleMac::Create() { |
| 353 DCHECK(!window_); | 353 DCHECK(!window_); |
| 354 | 354 |
| 355 window_ = [[NSWindow alloc] initWithContentRect:NSZeroRect | 355 window_ = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1) |
| 356 styleMask:NSBorderlessWindowMask | 356 styleMask:NSBorderlessWindowMask |
| 357 backing:NSBackingStoreBuffered | 357 backing:NSBackingStoreBuffered |
| 358 defer:YES]; | 358 defer:YES]; |
| 359 [window_ setMovableByWindowBackground:NO]; | 359 [window_ setMovableByWindowBackground:NO]; |
| 360 [window_ setBackgroundColor:[NSColor clearColor]]; | 360 [window_ setBackgroundColor:[NSColor clearColor]]; |
| 361 [window_ setLevel:NSNormalWindowLevel]; | 361 [window_ setLevel:NSNormalWindowLevel]; |
| 362 [window_ setOpaque:NO]; | 362 [window_ setOpaque:NO]; |
| 363 [window_ setHasShadow:NO]; | 363 [window_ setHasShadow:NO]; |
| 364 | 364 |
| 365 // We do not need to worry about the bubble outliving |parent_| because our | 365 // We do not need to worry about the bubble outliving |parent_| because our |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 SetState(kBubbleHidden); | 429 SetState(kBubbleHidden); |
| 430 } | 430 } |
| 431 } | 431 } |
| 432 } | 432 } |
| 433 | 433 |
| 434 void StatusBubbleMac::SetState(StatusBubbleState state) { | 434 void StatusBubbleMac::SetState(StatusBubbleState state) { |
| 435 if (state == state_) | 435 if (state == state_) |
| 436 return; | 436 return; |
| 437 | 437 |
| 438 if (state == kBubbleHidden) | 438 if (state == kBubbleHidden) |
| 439 [window_ setFrame:NSZeroRect display:YES]; | 439 [window_ setFrame:NSMakeRect(0, 0, 1, 1) display:YES]; |
| 440 | 440 |
| 441 if ([delegate_ respondsToSelector:@selector(statusBubbleWillEnterState:)]) | 441 if ([delegate_ respondsToSelector:@selector(statusBubbleWillEnterState:)]) |
| 442 [delegate_ statusBubbleWillEnterState:state]; | 442 [delegate_ statusBubbleWillEnterState:state]; |
| 443 | 443 |
| 444 state_ = state; | 444 state_ = state; |
| 445 } | 445 } |
| 446 | 446 |
| 447 void StatusBubbleMac::Fade(bool show) { | 447 void StatusBubbleMac::Fade(bool show) { |
| 448 DCHECK([NSThread isMainThread]); | 448 DCHECK([NSThread isMainThread]); |
| 449 | 449 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 683 |
| 684 if (expanded_width) { | 684 if (expanded_width) { |
| 685 size.width = screenRect.size.width; | 685 size.width = screenRect.size.width; |
| 686 } else { | 686 } else { |
| 687 size.width = kWindowWidthPercent * screenRect.size.width; | 687 size.width = kWindowWidthPercent * screenRect.size.width; |
| 688 } | 688 } |
| 689 | 689 |
| 690 screenRect.size = size; | 690 screenRect.size = size; |
| 691 return screenRect; | 691 return screenRect; |
| 692 } | 692 } |
| OLD | NEW |