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

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

Issue 7003063: Enforce different min size for popups than tabbed browsers on MacOSX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address prev round of feedback Created 9 years, 6 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 | « chrome/app/nibs/BrowserWindow.xib ('k') | chrome/browser/ui/cocoa/browser_window_controller.h » ('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) 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/browser_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 BrowserList::SetLastActive(browser_); 69 BrowserList::SetLastActive(browser_);
70 70
71 [window() makeKeyAndOrderFront:controller_]; 71 [window() makeKeyAndOrderFront:controller_];
72 } 72 }
73 73
74 void BrowserWindowCocoa::ShowInactive() { 74 void BrowserWindowCocoa::ShowInactive() {
75 [window() orderFront:controller_]; 75 [window() orderFront:controller_];
76 } 76 }
77 77
78 void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) { 78 void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) {
79 gfx::Rect real_bounds = [controller_ enforceMinWindowSize:bounds];
80
79 SetFullscreen(false); 81 SetFullscreen(false);
80 NSRect cocoa_bounds = NSMakeRect(bounds.x(), 0, bounds.width(), 82 NSRect cocoa_bounds = NSMakeRect(real_bounds.x(), 0,
81 bounds.height()); 83 real_bounds.width(),
84 real_bounds.height());
82 // Flip coordinates based on the primary screen. 85 // Flip coordinates based on the primary screen.
83 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; 86 NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
84 cocoa_bounds.origin.y = 87 cocoa_bounds.origin.y =
85 [screen frame].size.height - bounds.height() - bounds.y(); 88 [screen frame].size.height - real_bounds.height() - real_bounds.y();
86 89
87 [window() setFrame:cocoa_bounds display:YES]; 90 [window() setFrame:cocoa_bounds display:YES];
88 } 91 }
89 92
90 // Callers assume that this doesn't immediately delete the Browser object. 93 // Callers assume that this doesn't immediately delete the Browser object.
91 // The controller implementing the window delegate methods called from 94 // The controller implementing the window delegate methods called from
92 // |-performClose:| must take precautions to ensure that. 95 // |-performClose:| must take precautions to ensure that.
93 void BrowserWindowCocoa::Close() { 96 void BrowserWindowCocoa::Close() {
94 // If there is an overlay window, we contain a tab being dragged between 97 // If there is an overlay window, we contain a tab being dragged between
95 // windows. Don't hide the window as it makes the UI extra confused. We can 98 // windows. Don't hide the window as it makes the UI extra confused. We can
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 603
601 NSWindow* BrowserWindowCocoa::window() const { 604 NSWindow* BrowserWindowCocoa::window() const {
602 return [controller_ window]; 605 return [controller_ window];
603 } 606 }
604 607
605 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { 608 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) {
606 if (tab_contents == browser_->GetSelectedTabContents()) { 609 if (tab_contents == browser_->GetSelectedTabContents()) {
607 [controller_ updateSidebarForContents:tab_contents]; 610 [controller_ updateSidebarForContents:tab_contents];
608 } 611 }
609 } 612 }
OLDNEW
« no previous file with comments | « chrome/app/nibs/BrowserWindow.xib ('k') | chrome/browser/ui/cocoa/browser_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698