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

Side by Side Diff: chrome/browser/cocoa/status_bubble_mac.mm

Issue 3041028: [Mac] Reposition the status bubble whenever adding it to a window.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/cocoa/status_bubble_mac_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/status_bubble_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698