| 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/chrome_confirm_infobar_delegate_factory.h" |
| 9 #include "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" | 10 #include "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" |
| 10 #include "components/infobars/core/confirm_infobar_delegate.h" | 11 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 11 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT
weaker.h" | 12 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT
weaker.h" |
| 12 #import "ui/base/cocoa/cocoa_base_utils.h" | 13 #import "ui/base/cocoa/cocoa_base_utils.h" |
| 13 #import "ui/base/cocoa/controls/hyperlink_text_view.h" | 14 #import "ui/base/cocoa/controls/hyperlink_text_view.h" |
| 14 #include "ui/base/window_open_disposition.h" | 15 #include "ui/base/window_open_disposition.h" |
| 15 | 16 |
| 16 @implementation ConfirmInfoBarController | 17 @implementation ConfirmInfoBarController |
| 17 | 18 |
| 18 // Called when someone clicks on the "OK" button. | 19 // Called when someone clicks on the "OK" button. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 if (![self isOwned]) | 131 if (![self isOwned]) |
| 131 return; | 132 return; |
| 132 WindowOpenDisposition disposition = | 133 WindowOpenDisposition disposition = |
| 133 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); | 134 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); |
| 134 if ([self delegate]->AsConfirmInfoBarDelegate()->LinkClicked(disposition)) | 135 if ([self delegate]->AsConfirmInfoBarDelegate()->LinkClicked(disposition)) |
| 135 [self removeSelf]; | 136 [self removeSelf]; |
| 136 } | 137 } |
| 137 | 138 |
| 138 @end | 139 @end |
| 139 | 140 |
| 140 // static | 141 scoped_ptr<infobars::InfoBar> |
| 141 scoped_ptr<infobars::InfoBar> ConfirmInfoBarDelegate::CreateInfoBar( | 142 ChromeConfirmInfoBarDelegateFactory::CreateInfoBar( |
| 142 scoped_ptr<ConfirmInfoBarDelegate> delegate) { | 143 scoped_ptr<ConfirmInfoBarDelegate> delegate) { |
| 143 scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(delegate.Pass())); | 144 scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(delegate.Pass())); |
| 144 base::scoped_nsobject<ConfirmInfoBarController> controller( | 145 base::scoped_nsobject<ConfirmInfoBarController> controller( |
| 145 [[ConfirmInfoBarController alloc] initWithInfoBar:infobar.get()]); | 146 [[ConfirmInfoBarController alloc] initWithInfoBar:infobar.get()]); |
| 146 infobar->set_controller(controller); | 147 infobar->set_controller(controller); |
| 147 return infobar.Pass(); | 148 return infobar.Pass(); |
| 148 } | 149 } |
| 150 |
| OLD | NEW |