| OLD | NEW |
| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 + (NSInteger)getFullscreenLeftOffset; | 221 + (NSInteger)getFullscreenLeftOffset; |
| 222 | 222 |
| 223 // Sets the width of both |viewA| and |viewB| to be the larger of the | 223 // Sets the width of both |viewA| and |viewB| to be the larger of the |
| 224 // two views' widths. Does not change either view's origin or height. | 224 // two views' widths. Does not change either view's origin or height. |
| 225 + (CGFloat)matchWidthsOf:(NSView*)viewA andOf:(NSView*)viewB; | 225 + (CGFloat)matchWidthsOf:(NSView*)viewA andOf:(NSView*)viewB; |
| 226 | 226 |
| 227 // Sets the offset of |viewA| so that its vertical center is aligned with the | 227 // Sets the offset of |viewA| so that its vertical center is aligned with the |
| 228 // vertical center of |viewB|. | 228 // vertical center of |viewB|. |
| 229 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB; | 229 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB; |
| 230 | 230 |
| 231 // BaseBubbleController override. |
| 232 - (IBAction)cancel:(id)sender; |
| 233 |
| 231 @end | 234 @end |
| 232 | 235 |
| 233 @implementation PermissionBubbleController | 236 @implementation PermissionBubbleController |
| 234 | 237 |
| 235 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge { | 238 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge { |
| 236 DCHECK(browser); | 239 DCHECK(browser); |
| 237 DCHECK(bridge); | 240 DCHECK(bridge); |
| 238 browser_ = browser; | 241 browser_ = browser; |
| 239 base::scoped_nsobject<PermissionBubbleWindow> window( | 242 base::scoped_nsobject<PermissionBubbleWindow> window( |
| 240 [[PermissionBubbleWindow alloc] | 243 [[PermissionBubbleWindow alloc] |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 } | 660 } |
| 658 | 661 |
| 659 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { | 662 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { |
| 660 NSRect frameA = [viewA frame]; | 663 NSRect frameA = [viewA frame]; |
| 661 NSRect frameB = [viewB frame]; | 664 NSRect frameB = [viewB frame]; |
| 662 frameA.origin.y = | 665 frameA.origin.y = |
| 663 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); | 666 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); |
| 664 [viewA setFrameOrigin:frameA.origin]; | 667 [viewA setFrameOrigin:frameA.origin]; |
| 665 } | 668 } |
| 666 | 669 |
| 670 - (IBAction)cancel:(id)sender { |
| 671 // This is triggered by ESC when the bubble has focus. |
| 672 DCHECK(delegate_); |
| 673 delegate_->Closing(); |
| 674 [super cancel:sender]; |
| 675 } |
| 676 |
| 667 @end // implementation PermissionBubbleController | 677 @end // implementation PermissionBubbleController |
| OLD | NEW |