| OLD | NEW |
| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 bool hasTabStrip = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); | 246 bool hasTabStrip = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); |
| 247 if ((self = [super initTabWindowControllerWithTabStrip:hasTabStrip])) { | 247 if ((self = [super initTabWindowControllerWithTabStrip:hasTabStrip])) { |
| 248 DCHECK(browser); | 248 DCHECK(browser); |
| 249 initializing_ = YES; | 249 initializing_ = YES; |
| 250 browser_.reset(browser); | 250 browser_.reset(browser); |
| 251 ownsBrowser_ = ownIt; | 251 ownsBrowser_ = ownIt; |
| 252 NSWindow* window = [self window]; | 252 NSWindow* window = [self window]; |
| 253 // Make the content view for the window have a layer. This will make all | 253 // Make the content view for the window have a layer. This will make all |
| 254 // sub-views have layers. This is necessary to ensure correct layer | 254 // sub-views have layers. This is necessary to ensure correct layer |
| 255 // ordering of all child views and their layers. | 255 // ordering of all child views and their layers. |
| 256 [[window contentView] cr_setWantsLayer:YES]; | 256 [[window contentView] setWantsLayer:YES]; |
| 257 windowShim_.reset(new BrowserWindowCocoa(browser, self)); | 257 windowShim_.reset(new BrowserWindowCocoa(browser, self)); |
| 258 | 258 |
| 259 // Set different minimum sizes on tabbed windows vs non-tabbed, e.g. popups. | 259 // Set different minimum sizes on tabbed windows vs non-tabbed, e.g. popups. |
| 260 // This has to happen before -enforceMinWindowSize: is called further down. | 260 // This has to happen before -enforceMinWindowSize: is called further down. |
| 261 NSSize minSize = [self isTabbedWindow] ? | 261 NSSize minSize = [self isTabbedWindow] ? |
| 262 NSMakeSize(400, 272) : NSMakeSize(100, 122); | 262 NSMakeSize(400, 272) : NSMakeSize(100, 122); |
| 263 [[self window] setMinSize:minSize]; | 263 [[self window] setMinSize:minSize]; |
| 264 | 264 |
| 265 // Create the bar visibility lock set; 10 is arbitrary, but should hopefully | 265 // Create the bar visibility lock set; 10 is arbitrary, but should hopefully |
| 266 // be big enough to hold all locks that'll ever be needed. | 266 // be big enough to hold all locks that'll ever be needed. |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 // Send new resize rect to foreground tab. | 1007 // Send new resize rect to foreground tab. |
| 1008 if (content::WebContents* contents = | 1008 if (content::WebContents* contents = |
| 1009 browser_->tab_strip_model()->GetActiveWebContents()) { | 1009 browser_->tab_strip_model()->GetActiveWebContents()) { |
| 1010 if (content::RenderViewHost* rvh = contents->GetRenderViewHost()) { | 1010 if (content::RenderViewHost* rvh = contents->GetRenderViewHost()) { |
| 1011 rvh->ResizeRectChanged(windowShim_->GetRootWindowResizerRect()); | 1011 rvh->ResizeRectChanged(windowShim_->GetRootWindowResizerRect()); |
| 1012 } | 1012 } |
| 1013 } | 1013 } |
| 1014 } | 1014 } |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 - (void)setAnimationInProgress:(BOOL)inProgress { | |
| 1018 [[self tabContentArea] setFastResizeMode:inProgress]; | |
| 1019 } | |
| 1020 | |
| 1021 // Update a toggle state for an NSMenuItem if modified. | 1017 // Update a toggle state for an NSMenuItem if modified. |
| 1022 // Take care to ensure |item| looks like a NSMenuItem. | 1018 // Take care to ensure |item| looks like a NSMenuItem. |
| 1023 // Called by validateUserInterfaceItem:. | 1019 // Called by validateUserInterfaceItem:. |
| 1024 - (void)updateToggleStateWithTag:(NSInteger)tag forItem:(id)item { | 1020 - (void)updateToggleStateWithTag:(NSInteger)tag forItem:(id)item { |
| 1025 if (![item respondsToSelector:@selector(state)] || | 1021 if (![item respondsToSelector:@selector(state)] || |
| 1026 ![item respondsToSelector:@selector(setState:)]) | 1022 ![item respondsToSelector:@selector(setState:)]) |
| 1027 return; | 1023 return; |
| 1028 | 1024 |
| 1029 // On Windows this logic happens in bookmark_bar_view.cc. On the | 1025 // On Windows this logic happens in bookmark_bar_view.cc. On the |
| 1030 // Mac we're a lot more MVC happy so we've moved it into a | 1026 // Mac we're a lot more MVC happy so we've moved it into a |
| (...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2296 | 2292 |
| 2297 - (BOOL)supportsBookmarkBar { | 2293 - (BOOL)supportsBookmarkBar { |
| 2298 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2294 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2299 } | 2295 } |
| 2300 | 2296 |
| 2301 - (BOOL)isTabbedWindow { | 2297 - (BOOL)isTabbedWindow { |
| 2302 return browser_->is_type_tabbed(); | 2298 return browser_->is_type_tabbed(); |
| 2303 } | 2299 } |
| 2304 | 2300 |
| 2305 @end // @implementation BrowserWindowController(WindowType) | 2301 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |