| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 bridge_ = bridge; | 256 bridge_ = bridge; |
| 257 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 257 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 258 [center addObserver:self | 258 [center addObserver:self |
| 259 selector:@selector(parentWindowDidMove:) | 259 selector:@selector(parentWindowDidMove:) |
| 260 name:NSWindowDidMoveNotification | 260 name:NSWindowDidMoveNotification |
| 261 object:[self getExpectedParentWindow]]; | 261 object:[self getExpectedParentWindow]]; |
| 262 } | 262 } |
| 263 return self; | 263 return self; |
| 264 } | 264 } |
| 265 | 265 |
| 266 - (LocationBarDecoration*)decorationForBubble { |
| 267 if (![self hasVisibleLocationBar]) |
| 268 return nullptr; |
| 269 |
| 270 LocationBarViewMac* location_bar = |
| 271 [[self.parentWindow windowController] locationBarBridge]; |
| 272 return location_bar->GetPageInfoDecoration(); |
| 273 } |
| 274 |
| 266 + (NSPoint)getAnchorPointForBrowser:(Browser*)browser { | 275 + (NSPoint)getAnchorPointForBrowser:(Browser*)browser { |
| 267 NSPoint anchor; | 276 NSPoint anchor; |
| 268 NSWindow* parentWindow = browser->window()->GetNativeWindow(); | 277 NSWindow* parentWindow = browser->window()->GetNativeWindow(); |
| 269 if ([PermissionBubbleController hasVisibleLocationBarForBrowser:browser]) { | 278 if ([PermissionBubbleController hasVisibleLocationBarForBrowser:browser]) { |
| 270 LocationBarViewMac* location_bar = | 279 LocationBarViewMac* location_bar = |
| 271 [[parentWindow windowController] locationBarBridge]; | 280 [[parentWindow windowController] locationBarBridge]; |
| 272 anchor = location_bar->GetPageInfoBubblePoint(); | 281 anchor = location_bar->GetPageInfoBubblePoint(); |
| 273 } else { | 282 } else { |
| 274 // Position the bubble on the left of the screen if there is no page info | 283 // Position the bubble on the left of the screen if there is no page info |
| 275 // button to point at. | 284 // button to point at. |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 } | 677 } |
| 669 | 678 |
| 670 - (IBAction)cancel:(id)sender { | 679 - (IBAction)cancel:(id)sender { |
| 671 // This is triggered by ESC when the bubble has focus. | 680 // This is triggered by ESC when the bubble has focus. |
| 672 DCHECK(delegate_); | 681 DCHECK(delegate_); |
| 673 delegate_->Closing(); | 682 delegate_->Closing(); |
| 674 [super cancel:sender]; | 683 [super cancel:sender]; |
| 675 } | 684 } |
| 676 | 685 |
| 677 @end // implementation PermissionBubbleController | 686 @end // implementation PermissionBubbleController |
| OLD | NEW |