| 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 InfoBarManager* infobar_manager = NULL; | 71 InfoBarService* infobar_service = |
| 72 if (contents) | 72 contents ? InfoBarService::FromWebContents(contents) : NULL; |
| 73 infobar_manager = InfoBarService::InfoBarManagerFromWebContents(contents); | 73 containerCocoa_->ChangeInfoBarManager(infobar_service); |
| 74 containerCocoa_->ChangeInfoBarManager(infobar_manager); | |
| 75 } | 74 } |
| 76 | 75 |
| 77 - (void)tabDetachedWithContents:(content::WebContents*)contents { | 76 - (void)tabDetachedWithContents:(content::WebContents*)contents { |
| 78 if (currentWebContents_ == contents) | 77 if (currentWebContents_ == contents) |
| 79 [self changeWebContents:NULL]; | 78 [self changeWebContents:NULL]; |
| 80 } | 79 } |
| 81 | 80 |
| 82 - (CGFloat)overlappingTipHeight { | 81 - (CGFloat)overlappingTipHeight { |
| 83 return containerCocoa_->GetVerticalOverlap(NULL); | 82 return containerCocoa_->GetVerticalOverlap(NULL); |
| 84 } | 83 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 154 |
| 156 // This code can be executed while InfoBarController is still on the stack, so | 155 // This code can be executed while InfoBarController is still on the stack, so |
| 157 // we retain and autorelease the controller to prevent it from being | 156 // we retain and autorelease the controller to prevent it from being |
| 158 // dealloc'ed too early. | 157 // dealloc'ed too early. |
| 159 [[controller retain] autorelease]; | 158 [[controller retain] autorelease]; |
| 160 [[controller view] removeFromSuperview]; | 159 [[controller view] removeFromSuperview]; |
| 161 [infobarControllers_ removeObject:controller]; | 160 [infobarControllers_ removeObject:controller]; |
| 162 } | 161 } |
| 163 | 162 |
| 164 @end | 163 @end |
| OLD | NEW |