Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 2233293003: Position Mac permission bubbles on the left when in fullscreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 // FocusTracker will fail to restore focus to anything, so we set the focus 440 // FocusTracker will fail to restore focus to anything, so we set the focus
441 // to the tab contents as a reasonable fall-back. 441 // to the tab contents as a reasonable fall-back.
442 [self focusTabContents]; 442 [self focusTabContents];
443 } 443 }
444 [sourceWindow orderOut:self]; 444 [sourceWindow orderOut:self];
445 445
446 // We're done moving focus, so re-enable bar visibility changes. 446 // We're done moving focus, so re-enable bar visibility changes.
447 [self enableBarVisibilityUpdates]; 447 [self enableBarVisibilityUpdates];
448 } 448 }
449 449
450 - (void)permissionBubbleWindowWillClose:(NSNotification*)notification {
451 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
452 [center removeObserver:self
453 name:NSWindowWillCloseNotification
454 object:[notification object]];
455 [self releaseBarVisibilityForOwner:[notification object]
456 withAnimation:YES
457 delay:YES];
458 }
459
460 - (void)updatePermissionBubbleAnchor { 450 - (void)updatePermissionBubbleAnchor {
461 PermissionRequestManager* manager = [self permissionRequestManager]; 451 PermissionRequestManager* manager = [self permissionRequestManager];
462 if (manager) 452 if (manager)
463 manager->UpdateAnchorPosition(); 453 manager->UpdateAnchorPosition();
464 } 454 }
465 455
466 - (void)configureFullscreenToolbarController { 456 - (void)configureFullscreenToolbarController {
467 BOOL fullscreenForTab = [self isFullscreenForTabContentOrExtension]; 457 BOOL fullscreenForTab = [self isFullscreenForTabContentOrExtension];
468 BOOL kioskMode = 458 BOOL kioskMode =
469 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); 459 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode);
470 BOOL showDropdown = 460 BOOL showDropdown =
471 !fullscreenForTab && !kioskMode && ([self floatingBarHasFocus]); 461 !fullscreenForTab && !kioskMode && ([self floatingBarHasFocus]);
472 462
473 PermissionRequestManager* manager = [self permissionRequestManager];
474 if (manager && manager->IsBubbleVisible()) {
475 NSWindow* bubbleWindow = manager->GetBubbleWindow();
476 DCHECK(bubbleWindow);
477 // A visible permission bubble will force the dropdown to remain
478 // visible.
479 [self lockBarVisibilityForOwner:bubbleWindow withAnimation:NO delay:NO];
480 showDropdown = YES;
481 // Register to be notified when the permission bubble is closed, to
482 // allow fullscreen to hide the dropdown.
483 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
484 [center addObserver:self
485 selector:@selector(permissionBubbleWindowWillClose:)
486 name:NSWindowWillCloseNotification
487 object:bubbleWindow];
488 }
489
490 NSView* contentView = [[self window] contentView]; 463 NSView* contentView = [[self window] contentView];
491 [fullscreenToolbarController_ 464 [fullscreenToolbarController_
492 setupFullscreenToolbarForContentView:contentView 465 setupFullscreenToolbarForContentView:contentView
493 showDropdown:showDropdown]; 466 showDropdown:showDropdown];
494 } 467 }
495 468
496 - (void)adjustUIForExitingFullscreenAndStopOmniboxSliding { 469 - (void)adjustUIForExitingFullscreenAndStopOmniboxSliding {
497 [fullscreenToolbarController_ exitFullscreenMode]; 470 [fullscreenToolbarController_ exitFullscreenMode];
498 fullscreenToolbarController_.reset(); 471 fullscreenToolbarController_.reset();
499 472
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 if (fullscreenLowPowerCoordinator_) 1271 if (fullscreenLowPowerCoordinator_)
1299 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); 1272 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false);
1300 } 1273 }
1301 1274
1302 - (void)childWindowsDidChange { 1275 - (void)childWindowsDidChange {
1303 if (fullscreenLowPowerCoordinator_) 1276 if (fullscreenLowPowerCoordinator_)
1304 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); 1277 fullscreenLowPowerCoordinator_->ChildWindowsChanged();
1305 } 1278 }
1306 1279
1307 @end // @implementation BrowserWindowController(Private) 1280 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698