Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1011)

Unified Diff: chrome/browser/cocoa/status_bubble_mac.mm

Issue 266018: Mac: Resize status bubble when window is resized. (Closed)
Patch Set: Updated per Avi's comments (more or less). Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/status_bubble_mac.mm
diff --git a/chrome/browser/cocoa/status_bubble_mac.mm b/chrome/browser/cocoa/status_bubble_mac.mm
index 7b592c6c8135e060c83836342f03bc5e5db78fae..3eef46103bc4c2f84227a1ddd9f5d3d039ae2d7a 100644
--- a/chrome/browser/cocoa/status_bubble_mac.mm
+++ b/chrome/browser/cocoa/status_bubble_mac.mm
@@ -182,11 +182,8 @@ void StatusBubbleMac::Create() {
if (window_)
return;
- NSRect rect = [parent_ frame];
- rect.size.height = kWindowHeight;
- rect.size.width = static_cast<int>(kWindowWidthPercent * rect.size.width);
// TODO(avi):fix this for RTL
- window_ = [[NSWindow alloc] initWithContentRect:rect
+ window_ = [[NSWindow alloc] initWithContentRect:CalculateWindowFrame()
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:YES];
@@ -227,3 +224,18 @@ void StatusBubbleMac::FadeOut() {
[NSAnimationContext endGrouping];
}
+void StatusBubbleMac::UpdateSizeAndPosition() {
+ if (!window_)
+ return;
+
+ [window_ setFrame:CalculateWindowFrame() display:YES];
+}
+
+NSRect StatusBubbleMac::CalculateWindowFrame() {
+ DCHECK(parent_);
+
+ NSRect rect = [parent_ frame];
+ rect.size.height = kWindowHeight;
+ rect.size.width = static_cast<int>(kWindowWidthPercent * rect.size.width);
+ return rect;
+}

Powered by Google App Engine
This is Rietveld 408576698