Chromium Code Reviews| 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] removeObserver:self]; | |
|
Robert Sesek
2015/12/15 15:19:36
This should be for only the specific notification
juncai
2015/12/15 17:43:55
Done.
| |
| 257 bridge_->OnBubbleClosing(); | 258 bridge_->OnBubbleClosing(); |
| 258 [super windowWillClose:notification]; | 259 [super windowWillClose:notification]; |
| 259 } | 260 } |
| 260 | 261 |
| 261 - (void)parentWindowWillToggleFullScreen:(NSNotification*)notification { | 262 - (void)parentWindowWillToggleFullScreen:(NSNotification*)notification { |
| 262 // Override the base class implementation, which would have closed the bubble. | 263 // Override the base class implementation, which would have closed the bubble. |
| 263 } | 264 } |
| 264 | 265 |
| 265 - (void)parentWindowDidResize:(NSNotification*)notification { | 266 - (void)parentWindowDidResize:(NSNotification*)notification { |
| 266 DCHECK(bridge_); | 267 DCHECK(bridge_); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 609 | 610 |
| 610 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { | 611 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { |
| 611 NSRect frameA = [viewA frame]; | 612 NSRect frameA = [viewA frame]; |
| 612 NSRect frameB = [viewB frame]; | 613 NSRect frameB = [viewB frame]; |
| 613 frameA.origin.y = | 614 frameA.origin.y = |
| 614 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); | 615 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); |
| 615 [viewA setFrameOrigin:frameA.origin]; | 616 [viewA setFrameOrigin:frameA.origin]; |
| 616 } | 617 } |
| 617 | 618 |
| 618 @end // implementation PermissionBubbleController | 619 @end // implementation PermissionBubbleController |
| OLD | NEW |