| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 DISALLOW_COPY_AND_ASSIGN(MenuDelegate); | 73 DISALLOW_COPY_AND_ASSIGN(MenuDelegate); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace | 76 } // namespace |
| 77 | 77 |
| 78 // NSPopUpButton with a menu containing two items: allow and block. | 78 // NSPopUpButton with a menu containing two items: allow and block. |
| 79 // One AllowBlockMenuButton is used for each requested permission when there are | 79 // One AllowBlockMenuButton is used for each requested permission when there are |
| 80 // multiple permissions in the bubble. | 80 // multiple permissions in the bubble. |
| 81 @interface AllowBlockMenuButton : NSPopUpButton { | 81 @interface AllowBlockMenuButton : NSPopUpButton { |
| 82 @private | 82 @private |
| 83 scoped_ptr<PermissionMenuModel> menuModel_; | 83 std::unique_ptr<PermissionMenuModel> menuModel_; |
| 84 base::scoped_nsobject<MenuController> menuController_; | 84 base::scoped_nsobject<MenuController> menuController_; |
| 85 } | 85 } |
| 86 | 86 |
| 87 - (id)initForURL:(const GURL&)url | 87 - (id)initForURL:(const GURL&)url |
| 88 allowed:(BOOL)allow | 88 allowed:(BOOL)allow |
| 89 index:(int)index | 89 index:(int)index |
| 90 delegate:(PermissionBubbleView::Delegate*)delegate; | 90 delegate:(PermissionBubbleView::Delegate*)delegate; |
| 91 | 91 |
| 92 // Returns the maximum width of its possible titles. | 92 // Returns the maximum width of its possible titles. |
| 93 - (CGFloat)maximumTitleWidth; | 93 - (CGFloat)maximumTitleWidth; |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 616 |
| 617 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { | 617 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { |
| 618 NSRect frameA = [viewA frame]; | 618 NSRect frameA = [viewA frame]; |
| 619 NSRect frameB = [viewB frame]; | 619 NSRect frameB = [viewB frame]; |
| 620 frameA.origin.y = | 620 frameA.origin.y = |
| 621 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); | 621 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); |
| 622 [viewA setFrameOrigin:frameA.origin]; | 622 [viewA setFrameOrigin:frameA.origin]; |
| 623 } | 623 } |
| 624 | 624 |
| 625 @end // implementation PermissionBubbleController | 625 @end // implementation PermissionBubbleController |
| OLD | NEW |