OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/infobars/infobar_container_controller.h" | 5 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
10 #include "chrome/browser/infobars/infobar.h" | 10 #include "chrome/browser/infobars/infobar.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 - (CGFloat)infobarArrowX { | 63 - (CGFloat)infobarArrowX { |
64 LocationBarViewMac* locationBar = | 64 LocationBarViewMac* locationBar = |
65 [[self browserWindowController] locationBarBridge]; | 65 [[self browserWindowController] locationBarBridge]; |
66 return locationBar->GetPageInfoBubblePoint().x; | 66 return locationBar->GetPageInfoBubblePoint().x; |
67 } | 67 } |
68 | 68 |
69 - (void)changeWebContents:(content::WebContents*)contents { | 69 - (void)changeWebContents:(content::WebContents*)contents { |
70 currentWebContents_ = contents; | 70 currentWebContents_ = contents; |
71 if (contents) { | 71 InfoBarManager* infobar_manager = NULL; |
72 containerCocoa_->ChangeInfoBarService( | 72 if (contents) |
73 InfoBarService::FromWebContents(contents)); | 73 infobar_manager = InfoBarService::InfoBarManagerFromWebContents(contents); |
74 } else { | 74 containerCocoa_->ChangeInfoBarManager(infobar_manager); |
75 containerCocoa_->ChangeInfoBarService(NULL); | |
76 } | |
77 } | 75 } |
78 | 76 |
79 - (void)tabDetachedWithContents:(content::WebContents*)contents { | 77 - (void)tabDetachedWithContents:(content::WebContents*)contents { |
80 if (currentWebContents_ == contents) | 78 if (currentWebContents_ == contents) |
81 [self changeWebContents:NULL]; | 79 [self changeWebContents:NULL]; |
82 } | 80 } |
83 | 81 |
84 - (CGFloat)overlappingTipHeight { | 82 - (CGFloat)overlappingTipHeight { |
85 return containerCocoa_->GetVerticalOverlap(NULL); | 83 return containerCocoa_->GetVerticalOverlap(NULL); |
86 } | 84 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 155 |
158 // This code can be executed while InfoBarController is still on the stack, so | 156 // This code can be executed while InfoBarController is still on the stack, so |
159 // we retain and autorelease the controller to prevent it from being | 157 // we retain and autorelease the controller to prevent it from being |
160 // dealloc'ed too early. | 158 // dealloc'ed too early. |
161 [[controller retain] autorelease]; | 159 [[controller retain] autorelease]; |
162 [[controller view] removeFromSuperview]; | 160 [[controller view] removeFromSuperview]; |
163 [infobarControllers_ removeObject:controller]; | 161 [infobarControllers_ removeObject:controller]; |
164 } | 162 } |
165 | 163 |
166 @end | 164 @end |
OLD | NEW |