OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/cocoa/browser_window_controller.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 | 8 |
9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 toolbarController_.reset([[ToolbarController alloc] | 248 toolbarController_.reset([[ToolbarController alloc] |
249 initWithModel:browser->toolbar_model() | 249 initWithModel:browser->toolbar_model() |
250 commands:browser->command_updater() | 250 commands:browser->command_updater() |
251 profile:browser->profile() | 251 profile:browser->profile() |
252 browser:browser | 252 browser:browser |
253 resizeDelegate:self]); | 253 resizeDelegate:self]); |
254 [toolbarController_ setHasToolbar:[self hasToolbar] | 254 [toolbarController_ setHasToolbar:[self hasToolbar] |
255 hasLocationBar:[self hasLocationBar]]; | 255 hasLocationBar:[self hasLocationBar]]; |
256 [[[self window] contentView] addSubview:[toolbarController_ view]]; | 256 [[[self window] contentView] addSubview:[toolbarController_ view]]; |
257 | 257 |
258 // This must be done after the view is added to the window since it relies | |
259 // on the window bounds to determine whether to show buttons or not. | |
260 [toolbarController_ createBrowserActionButtons]; | |
261 | |
262 // Create a sub-controller for the bookmark bar. | 258 // Create a sub-controller for the bookmark bar. |
263 bookmarkBarController_.reset( | 259 bookmarkBarController_.reset( |
264 [[BookmarkBarController alloc] | 260 [[BookmarkBarController alloc] |
265 initWithBrowser:browser_.get() | 261 initWithBrowser:browser_.get() |
266 initialWidth:NSWidth([[[self window] contentView] frame]) | 262 initialWidth:NSWidth([[[self window] contentView] frame]) |
267 delegate:self | 263 delegate:self |
268 resizeDelegate:self]); | 264 resizeDelegate:self]); |
269 | 265 |
270 // Add bookmark bar to the view hierarchy, which also triggers the nib load. | 266 // Add bookmark bar to the view hierarchy, which also triggers the nib load. |
271 // The bookmark bar is defined (in the nib) to be bottom-aligned to its | 267 // The bookmark bar is defined (in the nib) to be bottom-aligned to its |
(...skipping 23 matching lines...) Expand all Loading... |
295 addObserver:self | 291 addObserver:self |
296 selector:@selector(applicationDidHide:) | 292 selector:@selector(applicationDidHide:) |
297 name:NSApplicationDidHideNotification | 293 name:NSApplicationDidHideNotification |
298 object:nil]; | 294 object:nil]; |
299 [[NSNotificationCenter defaultCenter] | 295 [[NSNotificationCenter defaultCenter] |
300 addObserver:self | 296 addObserver:self |
301 selector:@selector(applicationDidUnhide:) | 297 selector:@selector(applicationDidUnhide:) |
302 name:NSApplicationDidUnhideNotification | 298 name:NSApplicationDidUnhideNotification |
303 object:nil]; | 299 object:nil]; |
304 | 300 |
| 301 // This must be done after the view is added to the window since it relies |
| 302 // on the window bounds to determine whether to show buttons or not. |
| 303 [toolbarController_ createBrowserActionButtons]; |
| 304 |
305 // We are done initializing now. | 305 // We are done initializing now. |
306 initializing_ = NO; | 306 initializing_ = NO; |
307 } | 307 } |
308 return self; | 308 return self; |
309 } | 309 } |
310 | 310 |
311 - (void)dealloc { | 311 - (void)dealloc { |
312 browser_->CloseAllTabs(); | 312 browser_->CloseAllTabs(); |
313 [downloadShelfController_ exiting]; | 313 [downloadShelfController_ exiting]; |
314 | 314 |
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 | 1796 |
1797 - (BOOL)supportsBookmarkBar { | 1797 - (BOOL)supportsBookmarkBar { |
1798 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 1798 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
1799 } | 1799 } |
1800 | 1800 |
1801 - (BOOL)isNormalWindow { | 1801 - (BOOL)isNormalWindow { |
1802 return browser_->type() == Browser::TYPE_NORMAL; | 1802 return browser_->type() == Browser::TYPE_NORMAL; |
1803 } | 1803 } |
1804 | 1804 |
1805 @end // @implementation BrowserWindowController(WindowType) | 1805 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |