| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // Create a controller for the toolbar, giving it the toolbar model object | 319 // Create a controller for the toolbar, giving it the toolbar model object |
| 320 // and the toolbar view from the nib. The controller will handle | 320 // and the toolbar view from the nib. The controller will handle |
| 321 // registering for the appropriate command state changes from the back-end. | 321 // registering for the appropriate command state changes from the back-end. |
| 322 // Adds the toolbar to the content area. | 322 // Adds the toolbar to the content area. |
| 323 toolbarController_.reset([[ToolbarController alloc] | 323 toolbarController_.reset([[ToolbarController alloc] |
| 324 initWithCommands:browser->command_controller()->command_updater() | 324 initWithCommands:browser->command_controller()->command_updater() |
| 325 profile:browser->profile() | 325 profile:browser->profile() |
| 326 browser:browser]); | 326 browser:browser]); |
| 327 [toolbarController_ setHasToolbar:[self hasToolbar] | 327 [toolbarController_ setHasToolbar:[self hasToolbar] |
| 328 hasLocationBar:[self hasLocationBar]]; | 328 hasLocationBar:[self hasLocationBar]]; |
| 329 shouldShowToolbar_ = YES; |
| 329 | 330 |
| 330 // Create a sub-controller for the bookmark bar. | 331 // Create a sub-controller for the bookmark bar. |
| 331 bookmarkBarController_.reset( | 332 bookmarkBarController_.reset( |
| 332 [[BookmarkBarController alloc] | 333 [[BookmarkBarController alloc] |
| 333 initWithBrowser:browser_.get() | 334 initWithBrowser:browser_.get() |
| 334 initialWidth:NSWidth([[[self window] contentView] frame]) | 335 initialWidth:NSWidth([[[self window] contentView] frame]) |
| 335 delegate:self | 336 delegate:self |
| 336 resizeDelegate:self]); | 337 resizeDelegate:self]); |
| 337 [bookmarkBarController_ setBookmarkBarEnabled:[self supportsBookmarkBar]]; | 338 [bookmarkBarController_ setBookmarkBarEnabled:[self supportsBookmarkBar]]; |
| 338 | 339 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 addObserver:self | 401 addObserver:self |
| 401 selector:@selector(applicationDidHide:) | 402 selector:@selector(applicationDidHide:) |
| 402 name:NSApplicationDidHideNotification | 403 name:NSApplicationDidHideNotification |
| 403 object:nil]; | 404 object:nil]; |
| 404 [[NSNotificationCenter defaultCenter] | 405 [[NSNotificationCenter defaultCenter] |
| 405 addObserver:self | 406 addObserver:self |
| 406 selector:@selector(applicationDidUnhide:) | 407 selector:@selector(applicationDidUnhide:) |
| 407 name:NSApplicationDidUnhideNotification | 408 name:NSApplicationDidUnhideNotification |
| 408 object:nil]; | 409 object:nil]; |
| 409 | 410 |
| 411 // Register for toolbar visibility notifications from LocationBarViewMac. |
| 412 [[NSNotificationCenter defaultCenter] |
| 413 addObserver:self |
| 414 selector:@selector(showToolbar:) |
| 415 name:chrome::kShowToolbarNotification |
| 416 object:nil]; |
| 417 [[NSNotificationCenter defaultCenter] |
| 418 addObserver:self |
| 419 selector:@selector(hideToolbar:) |
| 420 name:chrome::kHideToolbarNotification |
| 421 object:nil]; |
| 422 |
| 410 // This must be done after the view is added to the window since it relies | 423 // This must be done after the view is added to the window since it relies |
| 411 // on the window bounds to determine whether to show buttons or not. | 424 // on the window bounds to determine whether to show buttons or not. |
| 412 if ([self hasToolbar]) // Do not create the buttons in popups. | 425 if ([self hasToolbar]) // Do not create the buttons in popups. |
| 413 [toolbarController_ createBrowserActionButtons]; | 426 [toolbarController_ createBrowserActionButtons]; |
| 414 | 427 |
| 415 extension_keybinding_registry_.reset( | 428 extension_keybinding_registry_.reset( |
| 416 new ExtensionKeybindingRegistryCocoa(browser_->profile(), | 429 new ExtensionKeybindingRegistryCocoa(browser_->profile(), |
| 417 [self window], | 430 [self window], |
| 418 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, | 431 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, |
| 419 windowShim_.get())); | 432 windowShim_.get())); |
| (...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2275 | 2288 |
| 2276 - (BOOL)supportsBookmarkBar { | 2289 - (BOOL)supportsBookmarkBar { |
| 2277 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2290 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2278 } | 2291 } |
| 2279 | 2292 |
| 2280 - (BOOL)isTabbedWindow { | 2293 - (BOOL)isTabbedWindow { |
| 2281 return browser_->is_type_tabbed(); | 2294 return browser_->is_type_tabbed(); |
| 2282 } | 2295 } |
| 2283 | 2296 |
| 2284 @end // @implementation BrowserWindowController(WindowType) | 2297 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |