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

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

Issue 1534753003: [Mac] Fix regression where commands were disabled in full screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // set a flag, and constrain any resize by the allowed amounts. On further 177 // set a flag, and constrain any resize by the allowed amounts. On further
178 // shrinks, we check the flag (since the size/position of the window will no 178 // shrinks, we check the flag (since the size/position of the window will no
179 // longer indicate that the window is shrinking from an apparent zoomed state) 179 // longer indicate that the window is shrinking from an apparent zoomed state)
180 // and if it's set we continue to constrain the resize. 180 // and if it's set we continue to constrain the resize.
181 181
182 using content::OpenURLParams; 182 using content::OpenURLParams;
183 using content::Referrer; 183 using content::Referrer;
184 using content::RenderWidgetHostView; 184 using content::RenderWidgetHostView;
185 using content::WebContents; 185 using content::WebContents;
186 186
187 namespace {
188
189 void SetUpBrowserWindowCommandHandler(NSWindow* window) {
190 // Make the window handle browser window commands.
191 [base::mac::ObjCCastStrict<ChromeEventProcessingWindow>(window)
192 setCommandHandler:[[[BrowserWindowCommandHandler alloc] init]
193 autorelease]];
194 }
195
196 } // namespace
197
187 @interface NSWindow (NSPrivateApis) 198 @interface NSWindow (NSPrivateApis)
188 // Note: These functions are private, use -[NSObject respondsToSelector:] 199 // Note: These functions are private, use -[NSObject respondsToSelector:]
189 // before calling them. 200 // before calling them.
190 201
191 - (void)setBottomCornerRounded:(BOOL)rounded; 202 - (void)setBottomCornerRounded:(BOOL)rounded;
192 203
193 - (NSRect)_growBoxRect; 204 - (NSRect)_growBoxRect;
194 205
195 @end 206 @end
196 207
(...skipping 23 matching lines...) Expand all
220 231
221 // Private(TestingAPI) init routine with testing options. 232 // Private(TestingAPI) init routine with testing options.
222 - (id)initWithBrowser:(Browser*)browser takeOwnership:(BOOL)ownIt { 233 - (id)initWithBrowser:(Browser*)browser takeOwnership:(BOOL)ownIt {
223 bool hasTabStrip = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); 234 bool hasTabStrip = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP);
224 if ((self = [super initTabWindowControllerWithTabStrip:hasTabStrip])) { 235 if ((self = [super initTabWindowControllerWithTabStrip:hasTabStrip])) {
225 DCHECK(browser); 236 DCHECK(browser);
226 initializing_ = YES; 237 initializing_ = YES;
227 browser_.reset(browser); 238 browser_.reset(browser);
228 ownsBrowser_ = ownIt; 239 ownsBrowser_ = ownIt;
229 NSWindow* window = [self window]; 240 NSWindow* window = [self window];
230 // Make the window handle browser window commands. 241 SetUpBrowserWindowCommandHandler(window);
231 [base::mac::ObjCCastStrict<ChromeEventProcessingWindow>(window)
232 setCommandHandler:[[[BrowserWindowCommandHandler alloc] init]
233 autorelease]];
234 242
235 // Make the content view for the window have a layer. This will make all 243 // Make the content view for the window have a layer. This will make all
236 // sub-views have layers. This is necessary to ensure correct layer 244 // sub-views have layers. This is necessary to ensure correct layer
237 // ordering of all child views and their layers. 245 // ordering of all child views and their layers.
238 [[window contentView] setWantsLayer:YES]; 246 [[window contentView] setWantsLayer:YES];
239 windowShim_.reset(new BrowserWindowCocoa(browser, self)); 247 windowShim_.reset(new BrowserWindowCocoa(browser, self));
240 248
241 // Set different minimum sizes on tabbed windows vs non-tabbed, e.g. popups. 249 // Set different minimum sizes on tabbed windows vs non-tabbed, e.g. popups.
242 // This has to happen before -enforceMinWindowSize: is called further down. 250 // This has to happen before -enforceMinWindowSize: is called further down.
243 NSSize minSize = [self isTabbedWindow] ? 251 NSSize minSize = [self isTabbedWindow] ?
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 // Shouldn't call addFindBar twice. 1449 // Shouldn't call addFindBar twice.
1442 DCHECK(!findBarCocoaController_.get()); 1450 DCHECK(!findBarCocoaController_.get());
1443 1451
1444 // Create a controller for the findbar. 1452 // Create a controller for the findbar.
1445 findBarCocoaController_.reset([findBarCocoaController retain]); 1453 findBarCocoaController_.reset([findBarCocoaController retain]);
1446 [self layoutSubviews]; 1454 [self layoutSubviews];
1447 [self updateSubviewZOrder]; 1455 [self updateSubviewZOrder];
1448 } 1456 }
1449 1457
1450 - (NSWindow*)createFullscreenWindow { 1458 - (NSWindow*)createFullscreenWindow {
1451 return [[[FullscreenWindow alloc] initForScreen:[[self window] screen]] 1459 NSWindow* window = [[[FullscreenWindow alloc]
1452 autorelease]; 1460 initForScreen:[[self window] screen]] autorelease];
1461 SetUpBrowserWindowCommandHandler(window);
1462 return window;
1453 } 1463 }
1454 1464
1455 - (NSInteger)numberOfTabs { 1465 - (NSInteger)numberOfTabs {
1456 // count() includes pinned tabs. 1466 // count() includes pinned tabs.
1457 return browser_->tab_strip_model()->count(); 1467 return browser_->tab_strip_model()->count();
1458 } 1468 }
1459 1469
1460 - (BOOL)hasLiveTabs { 1470 - (BOOL)hasLiveTabs {
1461 return !browser_->tab_strip_model()->empty(); 1471 return !browser_->tab_strip_model()->empty();
1462 } 1472 }
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 2088
2079 - (BOOL)supportsBookmarkBar { 2089 - (BOOL)supportsBookmarkBar {
2080 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2090 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2081 } 2091 }
2082 2092
2083 - (BOOL)isTabbedWindow { 2093 - (BOOL)isTabbedWindow {
2084 return browser_->is_type_tabbed(); 2094 return browser_->is_type_tabbed();
2085 } 2095 }
2086 2096
2087 @end // @implementation BrowserWindowController(WindowType) 2097 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698