| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #import "base/auto_reset.h" | 9 #import "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 262 |
| 263 base::scoped_nsobject<BrowserWindowLayout> layout( | 263 base::scoped_nsobject<BrowserWindowLayout> layout( |
| 264 [[BrowserWindowLayout alloc] init]); | 264 [[BrowserWindowLayout alloc] init]); |
| 265 [self updateLayoutParameters:layout]; | 265 [self updateLayoutParameters:layout]; |
| 266 [self applyLayout:layout]; | 266 [self applyLayout:layout]; |
| 267 | 267 |
| 268 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; | 268 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; |
| 269 | 269 |
| 270 // Will update the location of the permission bubble when showing/hiding the | 270 // Will update the location of the permission bubble when showing/hiding the |
| 271 // top level toolbar in fullscreen. | 271 // top level toolbar in fullscreen. |
| 272 PermissionRequestManager* manager = [self permissionRequestManager]; | 272 [self updatePermissionBubbleAnchor]; |
| 273 if (manager) | |
| 274 manager->UpdateAnchorPosition(); | |
| 275 | 273 |
| 276 browser_->GetBubbleManager()->UpdateAllBubbleAnchors(); | 274 browser_->GetBubbleManager()->UpdateAllBubbleAnchors(); |
| 277 } | 275 } |
| 278 | 276 |
| 279 - (void)applyTabStripLayout:(const chrome::TabStripLayout&)layout { | 277 - (void)applyTabStripLayout:(const chrome::TabStripLayout&)layout { |
| 280 // Update the presence of the window controls. | 278 // Update the presence of the window controls. |
| 281 if (layout.addCustomWindowControls) | 279 if (layout.addCustomWindowControls) |
| 282 [tabStripController_ addCustomWindowControls]; | 280 [tabStripController_ addCustomWindowControls]; |
| 283 else | 281 else |
| 284 [tabStripController_ removeCustomWindowControls]; | 282 [tabStripController_ removeCustomWindowControls]; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 [[destWindow contentView] addSubview:tabStripView]; | 412 [[destWindow contentView] addSubview:tabStripView]; |
| 415 | 413 |
| 416 [sourceWindow setWindowController:nil]; | 414 [sourceWindow setWindowController:nil]; |
| 417 [self setWindow:destWindow]; | 415 [self setWindow:destWindow]; |
| 418 [destWindow setWindowController:self]; | 416 [destWindow setWindowController:self]; |
| 419 | 417 |
| 420 // Move the status bubble over, if we have one. | 418 // Move the status bubble over, if we have one. |
| 421 if (statusBubble_) | 419 if (statusBubble_) |
| 422 statusBubble_->SwitchParentWindow(destWindow); | 420 statusBubble_->SwitchParentWindow(destWindow); |
| 423 | 421 |
| 424 // Updates the bubble position. | 422 [self updatePermissionBubbleAnchor]; |
| 425 PermissionRequestManager* manager = [self permissionRequestManager]; | |
| 426 if (manager) | |
| 427 manager->UpdateAnchorPosition(); | |
| 428 | 423 |
| 429 // Move the title over. | 424 // Move the title over. |
| 430 [destWindow setTitle:[sourceWindow title]]; | 425 [destWindow setTitle:[sourceWindow title]]; |
| 431 | 426 |
| 432 // The window needs to be onscreen before we can set its first responder. | 427 // The window needs to be onscreen before we can set its first responder. |
| 433 // Ordering the window to the front can change the active Space (either to | 428 // Ordering the window to the front can change the active Space (either to |
| 434 // the window's old Space or to the application's assigned Space). To prevent | 429 // the window's old Space or to the application's assigned Space). To prevent |
| 435 // this by temporarily change the collectionBehavior. | 430 // this by temporarily change the collectionBehavior. |
| 436 NSWindowCollectionBehavior behavior = [sourceWindow collectionBehavior]; | 431 NSWindowCollectionBehavior behavior = [sourceWindow collectionBehavior]; |
| 437 [destWindow setCollectionBehavior: | 432 [destWindow setCollectionBehavior: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 455 - (void)permissionBubbleWindowWillClose:(NSNotification*)notification { | 450 - (void)permissionBubbleWindowWillClose:(NSNotification*)notification { |
| 456 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 451 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 457 [center removeObserver:self | 452 [center removeObserver:self |
| 458 name:NSWindowWillCloseNotification | 453 name:NSWindowWillCloseNotification |
| 459 object:[notification object]]; | 454 object:[notification object]]; |
| 460 [self releaseBarVisibilityForOwner:[notification object] | 455 [self releaseBarVisibilityForOwner:[notification object] |
| 461 withAnimation:YES | 456 withAnimation:YES |
| 462 delay:YES]; | 457 delay:YES]; |
| 463 } | 458 } |
| 464 | 459 |
| 460 - (void)updatePermissionBubbleAnchor { |
| 461 PermissionRequestManager* manager = [self permissionRequestManager]; |
| 462 if (manager) |
| 463 manager->UpdateAnchorPosition(); |
| 464 } |
| 465 |
| 465 - (void)configureFullscreenToolbarController { | 466 - (void)configureFullscreenToolbarController { |
| 466 BOOL fullscreenForTab = [self isFullscreenForTabContentOrExtension]; | 467 BOOL fullscreenForTab = [self isFullscreenForTabContentOrExtension]; |
| 467 BOOL kioskMode = | 468 BOOL kioskMode = |
| 468 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); | 469 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); |
| 469 BOOL showDropdown = | 470 BOOL showDropdown = |
| 470 !fullscreenForTab && !kioskMode && ([self floatingBarHasFocus]); | 471 !fullscreenForTab && !kioskMode && ([self floatingBarHasFocus]); |
| 471 | 472 |
| 472 PermissionRequestManager* manager = [self permissionRequestManager]; | 473 PermissionRequestManager* manager = [self permissionRequestManager]; |
| 473 if (manager && manager->IsBubbleVisible()) { | 474 if (manager && manager->IsBubbleVisible()) { |
| 474 NSWindow* bubbleWindow = manager->GetBubbleWindow(); | 475 NSWindow* bubbleWindow = manager->GetBubbleWindow(); |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 if (fullscreenLowPowerCoordinator_) | 1298 if (fullscreenLowPowerCoordinator_) |
| 1298 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); | 1299 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); |
| 1299 } | 1300 } |
| 1300 | 1301 |
| 1301 - (void)childWindowsDidChange { | 1302 - (void)childWindowsDidChange { |
| 1302 if (fullscreenLowPowerCoordinator_) | 1303 if (fullscreenLowPowerCoordinator_) |
| 1303 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); | 1304 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); |
| 1304 } | 1305 } |
| 1305 | 1306 |
| 1306 @end // @implementation BrowserWindowController(Private) | 1307 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |