| 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 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/mac_util.h" | 6 #include "base/mac_util.h" |
| 7 #include "chrome/browser/cocoa/infobar.h" | 7 #include "chrome/browser/cocoa/infobar.h" |
| 8 #import "chrome/browser/cocoa/infobar_container_controller.h" | 8 #import "chrome/browser/cocoa/infobar_container_controller.h" |
| 9 #import "chrome/browser/cocoa/infobar_controller.h" | 9 #import "chrome/browser/cocoa/infobar_controller.h" |
| 10 #include "chrome/browser/cocoa/tab_strip_model_observer_bridge.h" | 10 #include "chrome/browser/cocoa/tab_strip_model_observer_bridge.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 // NSMutableArray needs an initial capacity, and we rarely ever see | 83 // NSMutableArray needs an initial capacity, and we rarely ever see |
| 84 // more than two infobars at a time, so that seems like a good choice. | 84 // more than two infobars at a time, so that seems like a good choice. |
| 85 infobarControllers_.reset([[NSMutableArray alloc] initWithCapacity:2]); | 85 infobarControllers_.reset([[NSMutableArray alloc] initWithCapacity:2]); |
| 86 } | 86 } |
| 87 return self; | 87 return self; |
| 88 } | 88 } |
| 89 | 89 |
| 90 - (void)dealloc { | 90 - (void)dealloc { |
| 91 DCHECK([infobarControllers_ count] == 0); | 91 DCHECK([infobarControllers_ count] == 0); |
| 92 // Remove our view from its superview so it doesn't attempt to reference |
| 93 // it when the controller is gone. |
| 94 [[self view] removeFromSuperview]; |
| 92 [super dealloc]; | 95 [super dealloc]; |
| 93 } | 96 } |
| 94 | 97 |
| 95 - (void)removeDelegate:(InfoBarDelegate*)delegate { | 98 - (void)removeDelegate:(InfoBarDelegate*)delegate { |
| 96 DCHECK(currentTabContents_); | 99 DCHECK(currentTabContents_); |
| 97 currentTabContents_->RemoveInfoBar(delegate); | 100 currentTabContents_->RemoveInfoBar(delegate); |
| 98 } | 101 } |
| 99 | 102 |
| 100 // TabStripModelObserverBridge notifications | 103 // TabStripModelObserverBridge notifications |
| 101 - (void)selectTabWithContents:(TabContents*)newContents | 104 - (void)selectTabWithContents:(TabContents*)newContents |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 frame.origin.y = minY; | 202 frame.origin.y = minY; |
| 200 minY += frame.size.height; | 203 minY += frame.size.height; |
| 201 // TODO(rohitrao, jrg): Replace with an animator. | 204 // TODO(rohitrao, jrg): Replace with an animator. |
| 202 [view setFrame:frame]; | 205 [view setFrame:frame]; |
| 203 } | 206 } |
| 204 | 207 |
| 205 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; | 208 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; |
| 206 } | 209 } |
| 207 | 210 |
| 208 @end | 211 @end |
| OLD | NEW |