Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/download/download_shelf_controller.h" | 5 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "chrome/browser/download/download_stats.h" | 9 #include "chrome/browser/download/download_stats.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 selector:@selector(willEnterFullscreen) | 134 selector:@selector(willEnterFullscreen) |
| 135 name:kWillEnterFullscreenNotification | 135 name:kWillEnterFullscreenNotification |
| 136 object:nil]; | 136 object:nil]; |
| 137 [defaultCenter addObserver:self | 137 [defaultCenter addObserver:self |
| 138 selector:@selector(willLeaveFullscreen) | 138 selector:@selector(willLeaveFullscreen) |
| 139 name:kWillLeaveFullscreenNotification | 139 name:kWillLeaveFullscreenNotification |
| 140 object:nil]; | 140 object:nil]; |
| 141 [self installTrackingArea]; | 141 [self installTrackingArea]; |
| 142 } | 142 } |
| 143 | 143 |
| 144 - (void)dealloc { | 144 - (void)browserWillBeDestroyed { |
| 145 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 145 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 146 [self cancelAutoClose]; | 146 [self exiting]; |
|
tapted
2015/07/07 04:25:59
I think you can just move the contents of `exiting
jackhou1
2015/07/07 08:33:05
Done.
| |
| 147 [self removeTrackingArea]; | 147 bridge_.reset(); |
| 148 | 148 navigator_ = nullptr; |
| 149 // The controllers will unregister themselves as observers when they are | |
| 150 // deallocated. No need to do that here. | |
| 151 [super dealloc]; | |
| 152 } | 149 } |
| 153 | 150 |
| 154 // Called after the frame's rect has changed; usually when the height is | 151 // Called after the frame's rect has changed; usually when the height is |
| 155 // animated. | 152 // animated. |
| 156 - (void)viewFrameDidChange:(NSNotification*)notification { | 153 - (void)viewFrameDidChange:(NSNotification*)notification { |
| 157 // Anchor subviews at the top of |view|, so that it looks like the shelf | 154 // Anchor subviews at the top of |view|, so that it looks like the shelf |
| 158 // is sliding out. | 155 // is sliding out. |
| 159 CGFloat newShelfHeight = NSHeight([[self view] frame]); | 156 CGFloat newShelfHeight = NSHeight([[self view] frame]); |
| 160 if (newShelfHeight == currentShelfHeight_) | 157 if (newShelfHeight == currentShelfHeight_) |
| 161 return; | 158 return; |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 } | 501 } |
| 505 | 502 |
| 506 // Set the tracking off to create a new tracking area for the control. | 503 // Set the tracking off to create a new tracking area for the control. |
| 507 // When changing the bounds/frame on a HoverButton, the tracking isn't updated | 504 // When changing the bounds/frame on a HoverButton, the tracking isn't updated |
| 508 // correctly, it needs to be turned off and back on. | 505 // correctly, it needs to be turned off and back on. |
| 509 [hoverCloseButton_ setTrackingEnabled:NO]; | 506 [hoverCloseButton_ setTrackingEnabled:NO]; |
| 510 [hoverCloseButton_ setFrame:bounds]; | 507 [hoverCloseButton_ setFrame:bounds]; |
| 511 [hoverCloseButton_ setTrackingEnabled:YES]; | 508 [hoverCloseButton_ setTrackingEnabled:YES]; |
| 512 } | 509 } |
| 513 @end | 510 @end |
| OLD | NEW |