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/history_overlay_controller.h" | 5 #import "chrome/browser/ui/cocoa/history_overlay_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 | 82 |
| 83 - (id)initForMode:(HistoryOverlayMode)mode { | 83 - (id)initForMode:(HistoryOverlayMode)mode { |
| 84 if ((self = [super init])) { | 84 if ((self = [super init])) { |
| 85 mode_ = mode; | 85 mode_ = mode; |
| 86 DCHECK(mode == kHistoryOverlayModeBack || | 86 DCHECK(mode == kHistoryOverlayModeBack || |
| 87 mode == kHistoryOverlayModeForward); | 87 mode == kHistoryOverlayModeForward); |
| 88 } | 88 } |
| 89 return self; | 89 return self; |
| 90 } | 90 } |
| 91 | 91 |
| 92 - (void)dealloc { | |
| 93 [[BrowserWindowController | |
| 94 browserWindowControllerForView:[self view]] onOverlappedViewHidden]; | |
| 95 [self.view removeFromSuperview]; | |
| 96 [super dealloc]; | |
| 97 } | |
|
Nico
2013/12/27 23:56:13
This was added in https://chromiumcodereview.appsp
erikchen
2013/12/30 19:20:34
I've manually tested the repro conditions with bot
| |
| 98 | |
| 99 - (void)loadView { | 92 - (void)loadView { |
| 100 const gfx::Image& image = | 93 const gfx::Image& image = |
| 101 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 94 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 102 mode_ == kHistoryOverlayModeBack ? IDR_SWIPE_BACK | 95 mode_ == kHistoryOverlayModeBack ? IDR_SWIPE_BACK |
| 103 : IDR_SWIPE_FORWARD); | 96 : IDR_SWIPE_FORWARD); |
| 104 contentView_.reset( | 97 contentView_.reset( |
| 105 [[HistoryOverlayView alloc] initWithMode:mode_ | 98 [[HistoryOverlayView alloc] initWithMode:mode_ |
| 106 image:image.ToNSImage()]); | 99 image:image.ToNSImage()]); |
| 107 self.view = contentView_; | 100 self.view = contentView_; |
| 108 } | 101 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 [animation setDelegate:self]; | 152 [animation setDelegate:self]; |
| 160 [animation setDuration:kFadeOutDurationSeconds]; | 153 [animation setDuration:kFadeOutDurationSeconds]; |
| 161 NSMutableDictionary* dictionary = | 154 NSMutableDictionary* dictionary = |
| 162 [NSMutableDictionary dictionaryWithCapacity:1]; | 155 [NSMutableDictionary dictionaryWithCapacity:1]; |
| 163 [dictionary setObject:animation forKey:@"alphaValue"]; | 156 [dictionary setObject:animation forKey:@"alphaValue"]; |
| 164 [overlay setAnimations:dictionary]; | 157 [overlay setAnimations:dictionary]; |
| 165 [[overlay animator] setAlphaValue:0.0]; | 158 [[overlay animator] setAlphaValue:0.0]; |
| 166 } | 159 } |
| 167 | 160 |
| 168 - (void)animationDidStop:(CAAnimation*)theAnimation finished:(BOOL)finished { | 161 - (void)animationDidStop:(CAAnimation*)theAnimation finished:(BOOL)finished { |
| 162 [[BrowserWindowController | |
| 163 browserWindowControllerForView:[self view]] onOverlappedViewHidden]; | |
| 164 [self.view removeFromSuperview]; | |
| 169 // Destroy the CAAnimation and its strong reference to its delegate (this | 165 // Destroy the CAAnimation and its strong reference to its delegate (this |
| 170 // class). | 166 // class). |
| 171 [self.view setAnimations:nil]; | 167 [self.view setAnimations:nil]; |
| 172 } | 168 } |
| 173 | 169 |
| 174 @end | 170 @end |
| OLD | NEW |