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

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

Issue 2403763003: [Mac] Address buggy permission bubble behaviour on dismissal via ESC. (Closed)
Patch Set: Comments Created 4 years, 1 month 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 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 + (NSInteger)getFullscreenLeftOffset; 218 + (NSInteger)getFullscreenLeftOffset;
219 219
220 // Sets the width of both |viewA| and |viewB| to be the larger of the 220 // Sets the width of both |viewA| and |viewB| to be the larger of the
221 // two views' widths. Does not change either view's origin or height. 221 // two views' widths. Does not change either view's origin or height.
222 + (CGFloat)matchWidthsOf:(NSView*)viewA andOf:(NSView*)viewB; 222 + (CGFloat)matchWidthsOf:(NSView*)viewA andOf:(NSView*)viewB;
223 223
224 // Sets the offset of |viewA| so that its vertical center is aligned with the 224 // Sets the offset of |viewA| so that its vertical center is aligned with the
225 // vertical center of |viewB|. 225 // vertical center of |viewB|.
226 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB; 226 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB;
227 227
228 // BaseBubbleController override.
229 - (IBAction)cancel:(id)sender;
230
228 @end 231 @end
229 232
230 @implementation PermissionBubbleController 233 @implementation PermissionBubbleController
231 234
232 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge { 235 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge {
233 DCHECK(browser); 236 DCHECK(browser);
234 DCHECK(bridge); 237 DCHECK(bridge);
235 browser_ = browser; 238 browser_ = browser;
236 base::scoped_nsobject<PermissionBubbleWindow> window( 239 base::scoped_nsobject<PermissionBubbleWindow> window(
237 [[PermissionBubbleWindow alloc] 240 [[PermissionBubbleWindow alloc]
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 } 656 }
654 657
655 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { 658 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB {
656 NSRect frameA = [viewA frame]; 659 NSRect frameA = [viewA frame];
657 NSRect frameB = [viewB frame]; 660 NSRect frameB = [viewB frame];
658 frameA.origin.y = 661 frameA.origin.y =
659 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); 662 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2);
660 [viewA setFrameOrigin:frameA.origin]; 663 [viewA setFrameOrigin:frameA.origin];
661 } 664 }
662 665
666 - (IBAction)cancel:(id)sender {
667 // This is triggered by ESC when the bubble has focus.
668 DCHECK(delegate_);
669 delegate_->Closing();
670 [super cancel:sender];
671 }
672
663 @end // implementation PermissionBubbleController 673 @end // implementation PermissionBubbleController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698