OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.h" | 5 #include "chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
10 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" | 10 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (![self isOwned]) | 130 if (![self isOwned]) |
131 return; | 131 return; |
132 WindowOpenDisposition disposition = | 132 WindowOpenDisposition disposition = |
133 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); | 133 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); |
134 if ([self delegate]->AsConfirmInfoBarDelegate()->LinkClicked(disposition)) | 134 if ([self delegate]->AsConfirmInfoBarDelegate()->LinkClicked(disposition)) |
135 [self removeSelf]; | 135 [self removeSelf]; |
136 } | 136 } |
137 | 137 |
138 @end | 138 @end |
139 | 139 |
140 // static | 140 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
141 scoped_ptr<InfoBar> ConfirmInfoBarDelegate::CreateInfoBar( | 141 scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(owner, this)); |
142 scoped_ptr<ConfirmInfoBarDelegate> delegate) { | |
143 scoped_ptr<InfoBarCocoa> infobar( | |
144 new InfoBarCocoa(delegate.PassAs<InfoBarDelegate>())); | |
145 base::scoped_nsobject<ConfirmInfoBarController> controller( | 142 base::scoped_nsobject<ConfirmInfoBarController> controller( |
146 [[ConfirmInfoBarController alloc] initWithInfoBar:infobar.get()]); | 143 [[ConfirmInfoBarController alloc] initWithInfoBar:infobar.get()]); |
147 infobar->set_controller(controller); | 144 infobar->set_controller(controller); |
148 return infobar.PassAs<InfoBar>(); | 145 return infobar.release(); |
149 } | 146 } |
OLD | NEW |