| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |