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

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

Issue 13139004: Deprecate Browser::TYPE_PANEL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; 302 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT;
303 gfx::Rect desiredContentRect; 303 gfx::Rect desiredContentRect;
304 chrome::GetSavedWindowBoundsAndShowState(browser_.get(), 304 chrome::GetSavedWindowBoundsAndShowState(browser_.get(),
305 &desiredContentRect, 305 &desiredContentRect,
306 &show_state); 306 &show_state);
307 gfx::Rect windowRect = desiredContentRect; 307 gfx::Rect windowRect = desiredContentRect;
308 windowRect = [self enforceMinWindowSize:windowRect]; 308 windowRect = [self enforceMinWindowSize:windowRect];
309 309
310 // When we are given x/y coordinates of 0 on a created popup window, assume 310 // When we are given x/y coordinates of 0 on a created popup window, assume
311 // none were given by the window.open() command. 311 // none were given by the window.open() command.
312 if ((browser_->is_type_popup() || browser_->is_type_panel()) && 312 if (browser_->is_type_popup() &&
313 windowRect.x() == 0 && windowRect.y() == 0) { 313 windowRect.x() == 0 && windowRect.y() == 0) {
314 gfx::Size size = windowRect.size(); 314 gfx::Size size = windowRect.size();
315 windowRect.set_origin( 315 windowRect.set_origin(
316 WindowSizer::GetDefaultPopupOrigin(size, 316 WindowSizer::GetDefaultPopupOrigin(size,
317 browser_->host_desktop_type())); 317 browser_->host_desktop_type()));
318 } 318 }
319 319
320 // Size and position the window. Note that it is not yet onscreen. Popup 320 // Size and position the window. Note that it is not yet onscreen. Popup
321 // windows may get resized later on in this function, once the actual size 321 // windows may get resized later on in this function, once the actual size
322 // of the toolbar/tabstrip is known. 322 // of the toolbar/tabstrip is known.
323 windowShim_->SetBounds(windowRect); 323 windowShim_->SetBounds(windowRect);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 browser_->type() == Browser::TYPE_POPUP ? 397 browser_->type() == Browser::TYPE_POPUP ?
398 NSWindowCollectionBehaviorFullScreenPrimary : 398 NSWindowCollectionBehaviorFullScreenPrimary :
399 NSWindowCollectionBehaviorFullScreenAuxiliary; 399 NSWindowCollectionBehaviorFullScreenAuxiliary;
400 [window setCollectionBehavior:collectionBehavior]; 400 [window setCollectionBehavior:collectionBehavior];
401 401
402 // For a popup window, |desiredContentRect| contains the desired height of 402 // For a popup window, |desiredContentRect| contains the desired height of
403 // the content, not of the whole window. Now that all the views are laid 403 // the content, not of the whole window. Now that all the views are laid
404 // out, measure the current content area size and grow if needed. The 404 // out, measure the current content area size and grow if needed. The
405 // window has not been placed onscreen yet, so this extra resize will not 405 // window has not been placed onscreen yet, so this extra resize will not
406 // cause visible jank. 406 // cause visible jank.
407 if (browser_->is_type_popup() || browser_->is_type_panel()) { 407 if (browser_->is_type_popup()) {
408 CGFloat deltaH = desiredContentRect.height() - 408 CGFloat deltaH = desiredContentRect.height() -
409 NSHeight([[self tabContentArea] frame]); 409 NSHeight([[self tabContentArea] frame]);
410 // Do not shrink the window, as that may break minimum size invariants. 410 // Do not shrink the window, as that may break minimum size invariants.
411 if (deltaH > 0) { 411 if (deltaH > 0) {
412 // Convert from tabContentArea coordinates to window coordinates. 412 // Convert from tabContentArea coordinates to window coordinates.
413 NSSize convertedSize = 413 NSSize convertedSize =
414 [[self tabContentArea] convertSize:NSMakeSize(0, deltaH) 414 [[self tabContentArea] convertSize:NSMakeSize(0, deltaH)
415 toView:nil]; 415 toView:nil];
416 NSRect frame = [[self window] frame]; 416 NSRect frame = [[self window] frame];
417 frame.size.height += convertedSize.height; 417 frame.size.height += convertedSize.height;
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 2201
2202 - (BOOL)supportsBookmarkBar { 2202 - (BOOL)supportsBookmarkBar {
2203 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2203 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2204 } 2204 }
2205 2205
2206 - (BOOL)isTabbedWindow { 2206 - (BOOL)isTabbedWindow {
2207 return browser_->is_type_tabbed(); 2207 return browser_->is_type_tabbed();
2208 } 2208 }
2209 2209
2210 @end // @implementation BrowserWindowController(WindowType) 2210 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | chrome/browser/ui/extensions/shell_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698