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

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: Test name and whitespace tweaks. 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] setMinSize:MinWindowSizeForBrowserType(browser->type())];
250 NSMakeSize(400, 272) : NSMakeSize(100, 122);
251 [[self window] setMinSize:minSize];
252 249
253 // Lion will attempt to automagically save and restore the UI. This 250 // Lion will attempt to automagically save and restore the UI. This
254 // functionality appears to be leaky (or at least interacts badly with our 251 // functionality appears to be leaky (or at least interacts badly with our
255 // architecture) and thus BrowserWindowController never gets released. This 252 // architecture) and thus BrowserWindowController never gets released. This
256 // prevents the browser from being able to quit <http://crbug.com/79113>. 253 // prevents the browser from being able to quit <http://crbug.com/79113>.
257 [window setRestorable:NO]; 254 [window setRestorable:NO];
258 255
259 // Get the windows to swish in on Lion. 256 // Get the windows to swish in on Lion.
260 [window setAnimationBehavior:NSWindowAnimationBehaviorDocumentWindow]; 257 [window setAnimationBehavior:NSWindowAnimationBehaviorDocumentWindow];
261 258
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 - (BOOL)isDownloadShelfVisible { 1357 - (BOOL)isDownloadShelfVisible {
1361 return downloadShelfController_ != nil && 1358 return downloadShelfController_ != nil &&
1362 [downloadShelfController_ isVisible]; 1359 [downloadShelfController_ isVisible];
1363 } 1360 }
1364 1361
1365 - (void)createAndAddDownloadShelf { 1362 - (void)createAndAddDownloadShelf {
1366 if (!downloadShelfController_.get()) { 1363 if (!downloadShelfController_.get()) {
1367 downloadShelfController_.reset([[DownloadShelfController alloc] 1364 downloadShelfController_.reset([[DownloadShelfController alloc]
1368 initWithBrowser:browser_.get() resizeDelegate:self]); 1365 initWithBrowser:browser_.get() resizeDelegate:self]);
1369 [self.chromeContentView addSubview:[downloadShelfController_ view]]; 1366 [self.chromeContentView addSubview:[downloadShelfController_ view]];
1367 [self layoutSubviews];
1370 } 1368 }
1371 } 1369 }
1372 1370
1373 - (DownloadShelfController*)downloadShelf { 1371 - (DownloadShelfController*)downloadShelf {
1374 return downloadShelfController_; 1372 return downloadShelfController_;
1375 } 1373 }
1376 1374
1377 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { 1375 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController {
1378 // Shouldn't call addFindBar twice. 1376 // Shouldn't call addFindBar twice.
1379 DCHECK(!findBarCocoaController_.get()); 1377 DCHECK(!findBarCocoaController_.get());
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 2028
2031 - (NSRect)savedRegularWindowFrame { 2029 - (NSRect)savedRegularWindowFrame {
2032 return savedRegularWindowFrame_; 2030 return savedRegularWindowFrame_;
2033 } 2031 }
2034 2032
2035 - (BOOL)isFullscreenTransitionInProgress { 2033 - (BOOL)isFullscreenTransitionInProgress {
2036 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; 2034 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_;
2037 } 2035 }
2038 2036
2039 @end // @implementation BrowserWindowController(WindowType) 2037 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698