Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: chrome/browser/ui/cocoa/history_overlay_controller.mm

Issue 10913066: [Mac] Do not leave artifacts when using history navigation gestures. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: U can haz a test Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "grit/theme_resources.h" 8 #include "grit/theme_resources.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/image/image.h" 10 #include "ui/gfx/image/image.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 - (id)initForMode:(HistoryOverlayMode)mode { 86 - (id)initForMode:(HistoryOverlayMode)mode {
87 if ((self = [super init])) { 87 if ((self = [super init])) {
88 mode_ = mode; 88 mode_ = mode;
89 DCHECK(mode == kHistoryOverlayModeBack || 89 DCHECK(mode == kHistoryOverlayModeBack ||
90 mode == kHistoryOverlayModeForward); 90 mode == kHistoryOverlayModeForward);
91 } 91 }
92 return self; 92 return self;
93 } 93 }
94 94
95 - (void)dealloc {
96 [self.view removeFromSuperview];
97 [super dealloc];
98 }
99
95 - (void)loadView { 100 - (void)loadView {
96 const gfx::Image& image = 101 const gfx::Image& image =
97 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( 102 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
98 mode_ == kHistoryOverlayModeBack ? IDR_SWIPE_BACK 103 mode_ == kHistoryOverlayModeBack ? IDR_SWIPE_BACK
99 : IDR_SWIPE_FORWARD); 104 : IDR_SWIPE_FORWARD);
100 contentView_.reset( 105 contentView_.reset(
101 [[HistoryOverlayView alloc] initWithMode:mode_ 106 [[HistoryOverlayView alloc] initWithMode:mode_
102 image:image.ToNSImage()]); 107 image:image.ToNSImage()]);
103 self.view = contentView_; 108 self.view = contentView_;
104 } 109 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 [animation setDelegate:self]; 162 [animation setDelegate:self];
158 [animation setDuration:kFadeOutDurationSeconds]; 163 [animation setDuration:kFadeOutDurationSeconds];
159 NSMutableDictionary* dictionary = 164 NSMutableDictionary* dictionary =
160 [NSMutableDictionary dictionaryWithCapacity:1]; 165 [NSMutableDictionary dictionaryWithCapacity:1];
161 [dictionary setObject:animation forKey:@"alphaValue"]; 166 [dictionary setObject:animation forKey:@"alphaValue"];
162 [overlay setAnimations:dictionary]; 167 [overlay setAnimations:dictionary];
163 [[overlay animator] setAlphaValue:0.0]; 168 [[overlay animator] setAlphaValue:0.0];
164 } 169 }
165 170
166 - (void)animationDidStop:(CAAnimation*)theAnimation finished:(BOOL)finished { 171 - (void)animationDidStop:(CAAnimation*)theAnimation finished:(BOOL)finished {
167 [self.view removeFromSuperview]; 172 // Destroy the CAAnimation and its strong reference to its delegate (this
173 // class).
174 [self.view setAnimations:nil];
168 } 175 }
169 176
170 @end 177 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698