| 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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 616 |
| 617 - (void)onClose:(id)sender { | 617 - (void)onClose:(id)sender { |
| 618 DCHECK(delegate_); | 618 DCHECK(delegate_); |
| 619 delegate_->Closing(); | 619 delegate_->Closing(); |
| 620 } | 620 } |
| 621 | 621 |
| 622 - (void)activateTabWithContents:(content::WebContents*)newContents | 622 - (void)activateTabWithContents:(content::WebContents*)newContents |
| 623 previousContents:(content::WebContents*)oldContents | 623 previousContents:(content::WebContents*)oldContents |
| 624 atIndex:(NSInteger)index | 624 atIndex:(NSInteger)index |
| 625 reason:(int)reason { | 625 reason:(int)reason { |
| 626 // The show/hide of this bubble is handled by the PermissionBubbleManager. | 626 // The show/hide of this bubble is handled by the PermissionRequestManager. |
| 627 // So bypass the base class, which would close the bubble here. | 627 // So bypass the base class, which would close the bubble here. |
| 628 } | 628 } |
| 629 | 629 |
| 630 + (CGFloat)matchWidthsOf:(NSView*)viewA andOf:(NSView*)viewB { | 630 + (CGFloat)matchWidthsOf:(NSView*)viewA andOf:(NSView*)viewB { |
| 631 NSRect frameA = [viewA frame]; | 631 NSRect frameA = [viewA frame]; |
| 632 NSRect frameB = [viewB frame]; | 632 NSRect frameB = [viewB frame]; |
| 633 CGFloat width = std::max(NSWidth(frameA), NSWidth(frameB)); | 633 CGFloat width = std::max(NSWidth(frameA), NSWidth(frameB)); |
| 634 [viewA setFrameSize:NSMakeSize(width, NSHeight(frameA))]; | 634 [viewA setFrameSize:NSMakeSize(width, NSHeight(frameA))]; |
| 635 [viewB setFrameSize:NSMakeSize(width, NSHeight(frameB))]; | 635 [viewB setFrameSize:NSMakeSize(width, NSHeight(frameB))]; |
| 636 return width; | 636 return width; |
| 637 } | 637 } |
| 638 | 638 |
| 639 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { | 639 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { |
| 640 NSRect frameA = [viewA frame]; | 640 NSRect frameA = [viewA frame]; |
| 641 NSRect frameB = [viewB frame]; | 641 NSRect frameB = [viewB frame]; |
| 642 frameA.origin.y = | 642 frameA.origin.y = |
| 643 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); | 643 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); |
| 644 [viewA setFrameOrigin:frameA.origin]; | 644 [viewA setFrameOrigin:frameA.origin]; |
| 645 } | 645 } |
| 646 | 646 |
| 647 @end // implementation PermissionBubbleController | 647 @end // implementation PermissionBubbleController |
| OLD | NEW |