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

Side by Side Diff: chrome/browser/cocoa/toolbar_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
« no previous file with comments | « chrome/browser/cocoa/tab_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/toolbar_controller.h" 5 #import "chrome/browser/cocoa/toolbar_controller.h"
6 6
7 #include "app/l10n_util_mac.h" 7 #include "app/l10n_util_mac.h"
8 #include "base/mac_util.h" 8 #include "base/mac_util.h"
9 #include "base/nsimage_cache_mac.h" 9 #include "base/nsimage_cache_mac.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 return self; 121 return self;
122 } 122 }
123 123
124 - (void)dealloc { 124 - (void)dealloc {
125 // Make sure any code in the base class which assumes [self view] is 125 // Make sure any code in the base class which assumes [self view] is
126 // the "parent" view continues to work. 126 // the "parent" view continues to work.
127 hasToolbar_ = YES; 127 hasToolbar_ = YES;
128 128
129 if (trackingArea_.get()) 129 if (trackingArea_.get())
130 [[self view] removeTrackingArea:trackingArea_.get()]; 130 [[self view] removeTrackingArea:trackingArea_.get()];
131 // Remove our view from its superview so it doesn't attempt to reference
132 // it when the controller is gone.
133 [[self view] removeFromSuperview];
131 [super dealloc]; 134 [super dealloc];
132 } 135 }
133 136
134 // Called after the view is done loading and the outlets have been hooked up. 137 // Called after the view is done loading and the outlets have been hooked up.
135 // Now we can hook up bridges that rely on UI objects such as the location 138 // Now we can hook up bridges that rely on UI objects such as the location
136 // bar and button state. 139 // bar and button state.
137 - (void)awakeFromNib { 140 - (void)awakeFromNib {
138 // A bug in AppKit (<rdar://7298597>, <http://openradar.me/7298597>) causes 141 // A bug in AppKit (<rdar://7298597>, <http://openradar.me/7298597>) causes
139 // images loaded directly from nibs in a framework to not get their "template" 142 // images loaded directly from nibs in a framework to not get their "template"
140 // flags set properly. Thus, despite the images being set on the buttons in 143 // flags set properly. Thus, despite the images being set on the buttons in
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 521
519 NSRect r = NSMakeRect(minX, NSMinY(locationFrame), maxX - minX, 522 NSRect r = NSMakeRect(minX, NSMinY(locationFrame), maxX - minX,
520 NSHeight(locationFrame)); 523 NSHeight(locationFrame));
521 gfx::Rect stack_bounds( 524 gfx::Rect stack_bounds(
522 NSRectToCGRect([[self view] convertRect:r toView:nil])); 525 NSRectToCGRect([[self view] convertRect:r toView:nil]));
523 // Inset the bounds to just inside the visible edges (see comment above). 526 // Inset the bounds to just inside the visible edges (see comment above).
524 stack_bounds.Inset(kLocationStackEdgeWidth, 0); 527 stack_bounds.Inset(kLocationStackEdgeWidth, 0);
525 return stack_bounds; 528 return stack_bounds;
526 } 529 }
527 @end 530 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/tab_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698