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

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

Issue 10003005: Zero-sized windows are bad. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: formatting Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/mac/mac_util.h" 11 #include "base/mac/mac_util.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/sys_string_conversions.h" 14 #include "base/sys_string_conversions.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #import "chrome/browser/ui/cocoa/bubble_view.h" 16 #import "chrome/browser/ui/cocoa/bubble_view.h"
17 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
18 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" 18 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
19 #import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h" 19 #import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h"
20 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" 20 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h"
21 #include "ui/base/cocoa/window_size_constants.h"
21 #include "ui/base/text/text_elider.h" 22 #include "ui/base/text/text_elider.h"
22 #include "ui/gfx/point.h" 23 #include "ui/gfx/point.h"
23 24
24 namespace { 25 namespace {
25 26
26 const int kWindowHeight = 18; 27 const int kWindowHeight = 18;
27 28
28 // The width of the bubble in relation to the width of the parent window. 29 // The width of the bubble in relation to the width of the parent window.
29 const CGFloat kWindowWidthPercent = 1.0 / 3.0; 30 const CGFloat kWindowWidthPercent = 1.0 / 3.0;
30 31
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 SetFrameAvoidingMouse([window_ frame], location); 353 SetFrameAvoidingMouse([window_ frame], location);
353 } 354 }
354 355
355 void StatusBubbleMac::UpdateDownloadShelfVisibility(bool visible) { 356 void StatusBubbleMac::UpdateDownloadShelfVisibility(bool visible) {
356 UpdateSizeAndPosition(); 357 UpdateSizeAndPosition();
357 } 358 }
358 359
359 void StatusBubbleMac::Create() { 360 void StatusBubbleMac::Create() {
360 DCHECK(!window_); 361 DCHECK(!window_);
361 362
362 window_ = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1) 363 window_ = [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater
363 styleMask:NSBorderlessWindowMask 364 styleMask:NSBorderlessWindowMask
364 backing:NSBackingStoreBuffered 365 backing:NSBackingStoreBuffered
365 defer:YES]; 366 defer:YES];
366 [window_ setMovableByWindowBackground:NO]; 367 [window_ setMovableByWindowBackground:NO];
367 [window_ setBackgroundColor:[NSColor clearColor]]; 368 [window_ setBackgroundColor:[NSColor clearColor]];
368 [window_ setLevel:NSNormalWindowLevel]; 369 [window_ setLevel:NSNormalWindowLevel];
369 [window_ setOpaque:NO]; 370 [window_ setOpaque:NO];
370 [window_ setHasShadow:NO]; 371 [window_ setHasShadow:NO];
371 372
372 // We do not need to worry about the bubble outliving |parent_| because our 373 // We do not need to worry about the bubble outliving |parent_| because our
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 } 730 }
730 731
731 // Round the top corners when the bubble is below the parent window. 732 // Round the top corners when the bubble is below the parent window.
732 if (NSMinY(window_frame) < NSMinY(parent_frame)) { 733 if (NSMinY(window_frame) < NSMinY(parent_frame)) {
733 corner_flags |= kRoundedTopLeftCorner | kRoundedTopRightCorner; 734 corner_flags |= kRoundedTopLeftCorner | kRoundedTopRightCorner;
734 } 735 }
735 } 736 }
736 737
737 return corner_flags; 738 return corner_flags;
738 } 739 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/page_info_bubble_controller.mm ('k') | ui/base/cocoa/underlay_opengl_hosting_window.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698