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

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

Issue 11072002: Combined window positioning and show state determiniation in the WindowSizer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 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 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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <numeric> 8 #include <numeric>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // Get the windows to swish in on Lion. 261 // Get the windows to swish in on Lion.
262 if ([window respondsToSelector:@selector(setAnimationBehavior:)]) 262 if ([window respondsToSelector:@selector(setAnimationBehavior:)])
263 [window setAnimationBehavior:NSWindowAnimationBehaviorDocumentWindow]; 263 [window setAnimationBehavior:NSWindowAnimationBehaviorDocumentWindow];
264 264
265 // Get the most appropriate size for the window, then enforce the 265 // Get the most appropriate size for the window, then enforce the
266 // minimum width and height. The window shim will handle flipping 266 // minimum width and height. The window shim will handle flipping
267 // the coordinates for us so we can use it to save some code. 267 // the coordinates for us so we can use it to save some code.
268 // Note that this may leave a significant portion of the window 268 // Note that this may leave a significant portion of the window
269 // offscreen, but there will always be enough window onscreen to 269 // offscreen, but there will always be enough window onscreen to
270 // drag the whole window back into view. 270 // drag the whole window back into view.
271 gfx::Rect desiredContentRect = 271 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT;
272 chrome::GetSavedWindowBounds(browser_.get()); 272 gfx::Rect desiredContentRect;
273 chrome::GetSavedWindowBoundsAndShowState(browser_.get(),
274 &desiredContentRect,
275 &show_state);
273 gfx::Rect windowRect = desiredContentRect; 276 gfx::Rect windowRect = desiredContentRect;
274 windowRect = [self enforceMinWindowSize:windowRect]; 277 windowRect = [self enforceMinWindowSize:windowRect];
275 278
276 // When we are given x/y coordinates of 0 on a created popup window, assume 279 // When we are given x/y coordinates of 0 on a created popup window, assume
277 // none were given by the window.open() command. 280 // none were given by the window.open() command.
278 if ((browser_->is_type_popup() || browser_->is_type_panel()) && 281 if ((browser_->is_type_popup() || browser_->is_type_panel()) &&
279 windowRect.x() == 0 && windowRect.y() == 0) { 282 windowRect.x() == 0 && windowRect.y() == 0) {
280 gfx::Size size = windowRect.size(); 283 gfx::Size size = windowRect.size();
281 windowRect.set_origin( 284 windowRect.set_origin(
282 WindowSizer::GetDefaultPopupOrigin(size, 285 WindowSizer::GetDefaultPopupOrigin(size,
(...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 2210
2208 - (BOOL)supportsBookmarkBar { 2211 - (BOOL)supportsBookmarkBar {
2209 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2212 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2210 } 2213 }
2211 2214
2212 - (BOOL)isTabbedWindow { 2215 - (BOOL)isTabbedWindow {
2213 return browser_->is_type_tabbed(); 2216 return browser_->is_type_tabbed();
2214 } 2217 }
2215 2218
2216 @end // @implementation BrowserWindowController(WindowType) 2219 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | chrome/browser/ui/gtk/browser_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698