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/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 247 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
248 [center addObserver:self | 248 [center addObserver:self |
249 selector:@selector(parentWindowDidMove:) | 249 selector:@selector(parentWindowDidMove:) |
250 name:NSWindowDidMoveNotification | 250 name:NSWindowDidMoveNotification |
251 object:[self getExpectedParentWindow]]; | 251 object:[self getExpectedParentWindow]]; |
252 } | 252 } |
253 return self; | 253 return self; |
254 } | 254 } |
255 | 255 |
256 - (void)windowWillClose:(NSNotification*)notification { | 256 - (void)windowWillClose:(NSNotification*)notification { |
| 257 [[NSNotificationCenter defaultCenter] |
| 258 removeObserver:self |
| 259 name:NSWindowDidMoveNotification |
| 260 object:nil]; |
257 bridge_->OnBubbleClosing(); | 261 bridge_->OnBubbleClosing(); |
258 [super windowWillClose:notification]; | 262 [super windowWillClose:notification]; |
259 } | 263 } |
260 | 264 |
261 - (void)parentWindowWillToggleFullScreen:(NSNotification*)notification { | 265 - (void)parentWindowWillToggleFullScreen:(NSNotification*)notification { |
262 // Override the base class implementation, which would have closed the bubble. | 266 // Override the base class implementation, which would have closed the bubble. |
263 } | 267 } |
264 | 268 |
265 - (void)parentWindowDidResize:(NSNotification*)notification { | 269 - (void)parentWindowDidResize:(NSNotification*)notification { |
266 DCHECK(bridge_); | 270 DCHECK(bridge_); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 613 |
610 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { | 614 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { |
611 NSRect frameA = [viewA frame]; | 615 NSRect frameA = [viewA frame]; |
612 NSRect frameB = [viewB frame]; | 616 NSRect frameB = [viewB frame]; |
613 frameA.origin.y = | 617 frameA.origin.y = |
614 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); | 618 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); |
615 [viewA setFrameOrigin:frameA.origin]; | 619 [viewA setFrameOrigin:frameA.origin]; |
616 } | 620 } |
617 | 621 |
618 @end // implementation PermissionBubbleController | 622 @end // implementation PermissionBubbleController |
OLD | NEW |