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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm

Issue 2036973002: Correctly move permission bubbles after entering / exiting fullscreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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
« no previous file with comments | « chrome/browser/ui/cocoa/info_bubble_view.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/website_settings/permission_bubble_controller.h " 5 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h "
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/bind_objc_block.h" 9 #include "base/mac/bind_objc_block.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 bridge_->OnBubbleClosing(); 256 bridge_->OnBubbleClosing();
257 [super windowWillClose:notification]; 257 [super windowWillClose:notification];
258 } 258 }
259 259
260 - (void)parentWindowWillToggleFullScreen:(NSNotification*)notification { 260 - (void)parentWindowWillToggleFullScreen:(NSNotification*)notification {
261 // Override the base class implementation, which would have closed the bubble. 261 // Override the base class implementation, which would have closed the bubble.
262 } 262 }
263 263
264 - (void)parentWindowDidResize:(NSNotification*)notification { 264 - (void)parentWindowDidResize:(NSNotification*)notification {
265 DCHECK(bridge_); 265 DCHECK(bridge_);
266 [self setAnchorPoint:[self getExpectedAnchorPoint]]; 266 [self updateAnchorPosition];
267 } 267 }
268 268
269 - (void)parentWindowDidMove:(NSNotification*)notification { 269 - (void)parentWindowDidMove:(NSNotification*)notification {
270 DCHECK(bridge_); 270 DCHECK(bridge_);
271 [self setAnchorPoint:[self getExpectedAnchorPoint]]; 271 [self setAnchorPoint:[self getExpectedAnchorPoint]];
272 } 272 }
273 273
274 - (void)showWithDelegate:(PermissionBubbleView::Delegate*)delegate 274 - (void)showWithDelegate:(PermissionBubbleView::Delegate*)delegate
275 forRequests:(const std::vector<PermissionBubbleRequest*>&)requests 275 forRequests:(const std::vector<PermissionBubbleRequest*>&)requests
276 acceptStates:(const std::vector<bool>&)acceptStates { 276 acceptStates:(const std::vector<bool>&)acceptStates {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 [self setAnchorPoint:[self getExpectedAnchorPoint]]; 426 [self setAnchorPoint:[self getExpectedAnchorPoint]];
427 [self showWindow:nil]; 427 [self showWindow:nil];
428 [[self window] makeFirstResponder:nil]; 428 [[self window] makeFirstResponder:nil];
429 [[self window] setInitialFirstResponder:allowOrOkButton.get()]; 429 [[self window] setInitialFirstResponder:allowOrOkButton.get()];
430 } 430 }
431 } 431 }
432 432
433 - (void)updateAnchorPosition { 433 - (void)updateAnchorPosition {
434 [self setParentWindow:[self getExpectedParentWindow]]; 434 [self setParentWindow:[self getExpectedParentWindow]];
435 [self setAnchorPoint:[self getExpectedAnchorPoint]]; 435 [self setAnchorPoint:[self getExpectedAnchorPoint]];
436 [[self bubble] setArrowLocation:[self getExpectedArrowLocation]];
436 } 437 }
437 438
438 - (NSPoint)getExpectedAnchorPoint { 439 - (NSPoint)getExpectedAnchorPoint {
439 NSPoint anchor; 440 NSPoint anchor;
440 if ([self hasVisibleLocationBar]) { 441 if ([self hasVisibleLocationBar]) {
441 LocationBarViewMac* location_bar = 442 LocationBarViewMac* location_bar =
442 [[[self getExpectedParentWindow] windowController] locationBarBridge]; 443 [[[self getExpectedParentWindow] windowController] locationBarBridge];
443 anchor = location_bar->GetPageInfoBubblePoint(); 444 anchor = location_bar->GetPageInfoBubblePoint();
444 } else { 445 } else {
445 // Center the bubble if there's no location bar. 446 // Center the bubble if there's no location bar.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 630
630 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { 631 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB {
631 NSRect frameA = [viewA frame]; 632 NSRect frameA = [viewA frame];
632 NSRect frameB = [viewB frame]; 633 NSRect frameB = [viewB frame];
633 frameA.origin.y = 634 frameA.origin.y =
634 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); 635 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2);
635 [viewA setFrameOrigin:frameA.origin]; 636 [viewA setFrameOrigin:frameA.origin];
636 } 637 }
637 638
638 @end // implementation PermissionBubbleController 639 @end // implementation PermissionBubbleController
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/info_bubble_view.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698