| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 bridge_->OnBubbleClosing(); | 294 bridge_->OnBubbleClosing(); |
| 295 [super windowWillClose:notification]; | 295 [super windowWillClose:notification]; |
| 296 } | 296 } |
| 297 | 297 |
| 298 - (void)parentWindowWillToggleFullScreen:(NSNotification*)notification { | 298 - (void)parentWindowWillToggleFullScreen:(NSNotification*)notification { |
| 299 // Override the base class implementation, which would have closed the bubble. | 299 // Override the base class implementation, which would have closed the bubble. |
| 300 } | 300 } |
| 301 | 301 |
| 302 - (void)parentWindowDidResize:(NSNotification*)notification { | 302 - (void)parentWindowDidResize:(NSNotification*)notification { |
| 303 DCHECK(bridge_); | 303 DCHECK(bridge_); |
| 304 [self setAnchorPoint:[self getExpectedAnchorPoint]]; | 304 [self updateAnchorPosition]; |
| 305 } | 305 } |
| 306 | 306 |
| 307 - (void)parentWindowDidMove:(NSNotification*)notification { | 307 - (void)parentWindowDidMove:(NSNotification*)notification { |
| 308 DCHECK(bridge_); | 308 DCHECK(bridge_); |
| 309 [self setAnchorPoint:[self getExpectedAnchorPoint]]; | 309 [self setAnchorPoint:[self getExpectedAnchorPoint]]; |
| 310 } | 310 } |
| 311 | 311 |
| 312 - (void)showWithDelegate:(PermissionBubbleView::Delegate*)delegate | 312 - (void)showWithDelegate:(PermissionBubbleView::Delegate*)delegate |
| 313 forRequests:(const std::vector<PermissionBubbleRequest*>&)requests | 313 forRequests:(const std::vector<PermissionBubbleRequest*>&)requests |
| 314 acceptStates:(const std::vector<bool>&)acceptStates { | 314 acceptStates:(const std::vector<bool>&)acceptStates { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 [self setAnchorPoint:[self getExpectedAnchorPoint]]; | 464 [self setAnchorPoint:[self getExpectedAnchorPoint]]; |
| 465 [self showWindow:nil]; | 465 [self showWindow:nil]; |
| 466 [[self window] makeFirstResponder:nil]; | 466 [[self window] makeFirstResponder:nil]; |
| 467 [[self window] setInitialFirstResponder:allowOrOkButton.get()]; | 467 [[self window] setInitialFirstResponder:allowOrOkButton.get()]; |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 | 470 |
| 471 - (void)updateAnchorPosition { | 471 - (void)updateAnchorPosition { |
| 472 [self setParentWindow:[self getExpectedParentWindow]]; | 472 [self setParentWindow:[self getExpectedParentWindow]]; |
| 473 [self setAnchorPoint:[self getExpectedAnchorPoint]]; | 473 [self setAnchorPoint:[self getExpectedAnchorPoint]]; |
| 474 [[self bubble] setArrowLocation:[self getExpectedArrowLocation]]; |
| 474 } | 475 } |
| 475 | 476 |
| 476 - (NSPoint)getExpectedAnchorPoint { | 477 - (NSPoint)getExpectedAnchorPoint { |
| 477 return [PermissionBubbleController getAnchorPointForBrowser:browser_]; | 478 return [PermissionBubbleController getAnchorPointForBrowser:browser_]; |
| 478 } | 479 } |
| 479 | 480 |
| 480 - (bool)hasVisibleLocationBar { | 481 - (bool)hasVisibleLocationBar { |
| 481 return [PermissionBubbleController hasVisibleLocationBarForBrowser:browser_]; | 482 return [PermissionBubbleController hasVisibleLocationBarForBrowser:browser_]; |
| 482 } | 483 } |
| 483 | 484 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 638 |
| 638 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { | 639 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { |
| 639 NSRect frameA = [viewA frame]; | 640 NSRect frameA = [viewA frame]; |
| 640 NSRect frameB = [viewB frame]; | 641 NSRect frameB = [viewB frame]; |
| 641 frameA.origin.y = | 642 frameA.origin.y = |
| 642 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); | 643 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); |
| 643 [viewA setFrameOrigin:frameA.origin]; | 644 [viewA setFrameOrigin:frameA.origin]; |
| 644 } | 645 } |
| 645 | 646 |
| 646 @end // implementation PermissionBubbleController | 647 @end // implementation PermissionBubbleController |
| OLD | NEW |