Chromium Code Reviews| 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 // Updates the permission bubble position. |
|
tapted
2016/08/10 01:27:20
nit: this comment is obsolete with the method comm
karandeepb
2016/08/10 04:00:43
Done.
| |
| 425 PermissionRequestManager* manager = [self permissionRequestManager]; | 423 [self updatePermissionBubbleAnchor]; |
| 426 if (manager) | |
| 427 manager->UpdateAnchorPosition(); | |
| 428 | 424 |
| 429 // Move the title over. | 425 // Move the title over. |
| 430 [destWindow setTitle:[sourceWindow title]]; | 426 [destWindow setTitle:[sourceWindow title]]; |
| 431 | 427 |
| 432 // The window needs to be onscreen before we can set its first responder. | 428 // 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 | 429 // 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 | 430 // the window's old Space or to the application's assigned Space). To prevent |
| 435 // this by temporarily change the collectionBehavior. | 431 // this by temporarily change the collectionBehavior. |
| 436 NSWindowCollectionBehavior behavior = [sourceWindow collectionBehavior]; | 432 NSWindowCollectionBehavior behavior = [sourceWindow collectionBehavior]; |
| 437 [destWindow setCollectionBehavior: | 433 [destWindow setCollectionBehavior: |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 455 - (void)permissionBubbleWindowWillClose:(NSNotification*)notification { | 451 - (void)permissionBubbleWindowWillClose:(NSNotification*)notification { |
| 456 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 452 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 457 [center removeObserver:self | 453 [center removeObserver:self |
| 458 name:NSWindowWillCloseNotification | 454 name:NSWindowWillCloseNotification |
| 459 object:[notification object]]; | 455 object:[notification object]]; |
| 460 [self releaseBarVisibilityForOwner:[notification object] | 456 [self releaseBarVisibilityForOwner:[notification object] |
| 461 withAnimation:YES | 457 withAnimation:YES |
| 462 delay:YES]; | 458 delay:YES]; |
| 463 } | 459 } |
| 464 | 460 |
| 461 - (void)updatePermissionBubbleAnchor { | |
| 462 PermissionRequestManager* manager = [self permissionRequestManager]; | |
| 463 if (manager) | |
| 464 manager->UpdateAnchorPosition(); | |
| 465 } | |
| 466 | |
| 465 - (void)configureFullscreenToolbarController { | 467 - (void)configureFullscreenToolbarController { |
| 466 BOOL fullscreenForTab = [self isFullscreenForTabContentOrExtension]; | 468 BOOL fullscreenForTab = [self isFullscreenForTabContentOrExtension]; |
| 467 BOOL kioskMode = | 469 BOOL kioskMode = |
| 468 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); | 470 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); |
| 469 BOOL showDropdown = | 471 BOOL showDropdown = |
| 470 !fullscreenForTab && !kioskMode && ([self floatingBarHasFocus]); | 472 !fullscreenForTab && !kioskMode && ([self floatingBarHasFocus]); |
| 471 | 473 |
| 472 PermissionRequestManager* manager = [self permissionRequestManager]; | 474 PermissionRequestManager* manager = [self permissionRequestManager]; |
| 473 if (manager && manager->IsBubbleVisible()) { | 475 if (manager && manager->IsBubbleVisible()) { |
| 474 NSWindow* bubbleWindow = manager->GetBubbleWindow(); | 476 NSWindow* bubbleWindow = manager->GetBubbleWindow(); |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1297 if (fullscreenLowPowerCoordinator_) | 1299 if (fullscreenLowPowerCoordinator_) |
| 1298 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); | 1300 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); |
| 1299 } | 1301 } |
| 1300 | 1302 |
| 1301 - (void)childWindowsDidChange { | 1303 - (void)childWindowsDidChange { |
| 1302 if (fullscreenLowPowerCoordinator_) | 1304 if (fullscreenLowPowerCoordinator_) |
| 1303 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); | 1305 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); |
| 1304 } | 1306 } |
| 1305 | 1307 |
| 1306 @end // @implementation BrowserWindowController(Private) | 1308 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |