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

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

Issue 2742813003: [Mac] Lay out the browser window when adding the download shelf. (Closed)
Patch Set: Put a stray word away. Created 3 years, 9 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
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 #include <utility> 9 #include <utility>
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 ownsBrowser_ = ownIt; 237 ownsBrowser_ = ownIt;
238 NSWindow* window = [self window]; 238 NSWindow* window = [self window];
239 SetUpBrowserWindowCommandHandler(window); 239 SetUpBrowserWindowCommandHandler(window);
240 240
241 // Make the content view for the window have a layer. This will make all 241 // Make the content view for the window have a layer. This will make all
242 // sub-views have layers. This is necessary to ensure correct layer 242 // sub-views have layers. This is necessary to ensure correct layer
243 // ordering of all child views and their layers. 243 // ordering of all child views and their layers.
244 [[window contentView] setWantsLayer:YES]; 244 [[window contentView] setWantsLayer:YES];
245 windowShim_.reset(new BrowserWindowCocoa(browser, self)); 245 windowShim_.reset(new BrowserWindowCocoa(browser, self));
246 246
247 // Set different minimum sizes on tabbed windows vs non-tabbed, e.g. popups.
248 // This has to happen before -enforceMinWindowSize: is called further down. 247 // This has to happen before -enforceMinWindowSize: is called further down.
249 NSSize minSize = [self isTabbedWindow] ? 248 [[self window]
250 NSMakeSize(400, 272) : NSMakeSize(100, 122); 249 setMinSize:(browser->is_type_tabbed() ? kMinCocoaTabbedWindowSize
251 [[self window] setMinSize:minSize]; 250 : kMinCocoaPopupWindowSize)
251 .ToCGSize()];
252 252
253 // Lion will attempt to automagically save and restore the UI. This 253 // Lion will attempt to automagically save and restore the UI. This
254 // functionality appears to be leaky (or at least interacts badly with our 254 // functionality appears to be leaky (or at least interacts badly with our
255 // architecture) and thus BrowserWindowController never gets released. This 255 // architecture) and thus BrowserWindowController never gets released. This
256 // prevents the browser from being able to quit <http://crbug.com/79113>. 256 // prevents the browser from being able to quit <http://crbug.com/79113>.
257 [window setRestorable:NO]; 257 [window setRestorable:NO];
258 258
259 // Get the windows to swish in on Lion. 259 // Get the windows to swish in on Lion.
260 [window setAnimationBehavior:NSWindowAnimationBehaviorDocumentWindow]; 260 [window setAnimationBehavior:NSWindowAnimationBehaviorDocumentWindow];
261 261
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 - (BOOL)isDownloadShelfVisible { 1354 - (BOOL)isDownloadShelfVisible {
1355 return downloadShelfController_ != nil && 1355 return downloadShelfController_ != nil &&
1356 [downloadShelfController_ isVisible]; 1356 [downloadShelfController_ isVisible];
1357 } 1357 }
1358 1358
1359 - (void)createAndAddDownloadShelf { 1359 - (void)createAndAddDownloadShelf {
1360 if (!downloadShelfController_.get()) { 1360 if (!downloadShelfController_.get()) {
1361 downloadShelfController_.reset([[DownloadShelfController alloc] 1361 downloadShelfController_.reset([[DownloadShelfController alloc]
1362 initWithBrowser:browser_.get() resizeDelegate:self]); 1362 initWithBrowser:browser_.get() resizeDelegate:self]);
1363 [self.chromeContentView addSubview:[downloadShelfController_ view]]; 1363 [self.chromeContentView addSubview:[downloadShelfController_ view]];
1364 [self layoutSubviews];
1364 } 1365 }
1365 } 1366 }
1366 1367
1367 - (DownloadShelfController*)downloadShelf { 1368 - (DownloadShelfController*)downloadShelf {
1368 return downloadShelfController_; 1369 return downloadShelfController_;
1369 } 1370 }
1370 1371
1371 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { 1372 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController {
1372 // Shouldn't call addFindBar twice. 1373 // Shouldn't call addFindBar twice.
1373 DCHECK(!findBarCocoaController_.get()); 1374 DCHECK(!findBarCocoaController_.get());
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 2033
2033 - (NSRect)savedRegularWindowFrame { 2034 - (NSRect)savedRegularWindowFrame {
2034 return savedRegularWindowFrame_; 2035 return savedRegularWindowFrame_;
2035 } 2036 }
2036 2037
2037 - (BOOL)isFullscreenTransitionInProgress { 2038 - (BOOL)isFullscreenTransitionInProgress {
2038 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; 2039 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_;
2039 } 2040 }
2040 2041
2041 @end // @implementation BrowserWindowController(WindowType) 2042 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | chrome/browser/ui/cocoa/browser_window_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698