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

Side by Side Diff: chrome/browser/cocoa/download_shelf_controller.mm

Issue 267082: Makes it so when NSViewControllers go away that they remove their views from ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/cocoa/download_shelf_controller.h" 5 #import "chrome/browser/cocoa/download_shelf_controller.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/mac_util.h" 9 #include "base/mac_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 NSImage* favicon = rb.GetNSImageNamed(IDR_DOWNLOADS_FAVICON); 93 NSImage* favicon = rb.GetNSImageNamed(IDR_DOWNLOADS_FAVICON);
94 DCHECK(favicon); 94 DCHECK(favicon);
95 [image_ setImage:favicon]; 95 [image_ setImage:favicon];
96 96
97 [self resizeDownloadLinkToFit]; 97 [self resizeDownloadLinkToFit];
98 } 98 }
99 99
100 - (void)dealloc { 100 - (void)dealloc {
101 // The controllers will unregister themselves as observers when they are 101 // The controllers will unregister themselves as observers when they are
102 // deallocated. No need to do that here. 102 // deallocated. No need to do that here.
103
104 // Remove our view from its superview so it doesn't attempt to reference
105 // it when the controller is gone.
106 [[self view] removeFromSuperview];
103 [super dealloc]; 107 [super dealloc];
104 } 108 }
105 109
106 - (void)resizeDownloadLinkToFit { 110 - (void)resizeDownloadLinkToFit {
107 // Get width required by localized download link text. 111 // Get width required by localized download link text.
108 // http://developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/Tasks/ StringHeight.html 112 // http://developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/Tasks/ StringHeight.html
109 [[showAllDownloadsLink_ textContainer] setLineFragmentPadding:0.0]; 113 [[showAllDownloadsLink_ textContainer] setLineFragmentPadding:0.0];
110 (void)[[showAllDownloadsLink_ layoutManager] glyphRangeForTextContainer: 114 (void)[[showAllDownloadsLink_ layoutManager] glyphRangeForTextContainer:
111 [showAllDownloadsLink_ textContainer]]; 115 [showAllDownloadsLink_ textContainer]];
112 NSRect textRect = [[showAllDownloadsLink_ layoutManager] 116 NSRect textRect = [[showAllDownloadsLink_ layoutManager]
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 if (isTransferDone && 289 if (isTransferDone &&
286 [itemController download]->safety_state() != DownloadItem::DANGEROUS) { 290 [itemController download]->safety_state() != DownloadItem::DANGEROUS) {
287 [self remove:itemController]; 291 [self remove:itemController];
288 } else { 292 } else {
289 ++i; 293 ++i;
290 } 294 }
291 } 295 }
292 } 296 }
293 297
294 @end 298 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_controller.mm ('k') | chrome/browser/cocoa/extension_shelf_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698