| 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/permission_bubble/permission_bubble_controller.
h" | 5 #import "chrome/browser/ui/cocoa/permission_bubble/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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 maxMenuWidth = std::max(maxMenuWidth, [button maximumTitleWidth]); | 402 maxMenuWidth = std::max(maxMenuWidth, [button maximumTitleWidth]); |
| 403 } | 403 } |
| 404 maxPermissionLineWidth += maxMenuWidth; | 404 maxPermissionLineWidth += maxMenuWidth; |
| 405 } | 405 } |
| 406 | 406 |
| 407 // The title and 'x' button row must fit within the bubble. | 407 // The title and 'x' button row must fit within the bubble. |
| 408 CGFloat titleRowWidth = NSMaxX([titleView frame]) + | 408 CGFloat titleRowWidth = NSMaxX([titleView frame]) + |
| 409 NSWidth([closeButton frame]) + | 409 NSWidth([closeButton frame]) + |
| 410 chrome_style::kCloseButtonPadding; | 410 chrome_style::kCloseButtonPadding; |
| 411 | 411 |
| 412 bubbleFrame.size.width = std::max( | 412 bubbleFrame.size.width = |
| 413 NSWidth(bubbleFrame), std::max(titleRowWidth, maxPermissionLineWidth)); | 413 std::max(NSWidth(bubbleFrame), |
| 414 std::max(titleRowWidth, maxPermissionLineWidth)) + |
| 415 kHorizontalPadding; |
| 414 | 416 |
| 415 // Now that the bubble's dimensions have been set, lay out the buttons and | 417 // Now that the bubble's dimensions have been set, lay out the buttons and |
| 416 // menus. | 418 // menus. |
| 417 | 419 |
| 418 // Place the close button at the upper-right-hand corner of the bubble. | 420 // Place the close button at the upper-right-hand corner of the bubble. |
| 419 NSPoint closeButtonOrigin = | 421 NSPoint closeButtonOrigin = |
| 420 NSMakePoint(NSWidth(bubbleFrame) - NSWidth([closeButton frame]) - | 422 NSMakePoint(NSWidth(bubbleFrame) - NSWidth([closeButton frame]) - |
| 421 chrome_style::kCloseButtonPadding, | 423 chrome_style::kCloseButtonPadding, |
| 422 NSHeight(bubbleFrame) - NSWidth([closeButton frame]) - | 424 NSHeight(bubbleFrame) - NSWidth([closeButton frame]) - |
| 423 chrome_style::kCloseButtonPadding); | 425 chrome_style::kCloseButtonPadding); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 } | 660 } |
| 659 | 661 |
| 660 - (IBAction)cancel:(id)sender { | 662 - (IBAction)cancel:(id)sender { |
| 661 // This is triggered by ESC when the bubble has focus. | 663 // This is triggered by ESC when the bubble has focus. |
| 662 if (delegate_) | 664 if (delegate_) |
| 663 delegate_->Closing(); | 665 delegate_->Closing(); |
| 664 [super cancel:sender]; | 666 [super cancel:sender]; |
| 665 } | 667 } |
| 666 | 668 |
| 667 @end // implementation PermissionBubbleController | 669 @end // implementation PermissionBubbleController |
| OLD | NEW |