| 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 #import "ios/chrome/browser/infobars/confirm_infobar_controller.h" | 5 #import "ios/chrome/browser/infobars/confirm_infobar_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "components/infobars/core/confirm_infobar_delegate.h" | 10 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 11 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 11 #import "ios/chrome/browser/ui/infobars/infobar_view.h" |
| 12 #import "ios/public/provider/chrome/browser/ui/infobar_view_delegate.h" | 12 #import "ios/chrome/browser/ui/infobars/infobar_view_delegate.h" |
| 13 #import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h" | 13 #import "ios/chrome/browser/ui/infobars/infobar_view_protocol.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/window_open_disposition.h" | 15 #include "ui/base/window_open_disposition.h" |
| 16 #include "ui/gfx/image/image.h" | 16 #include "ui/gfx/image/image.h" |
| 17 | 17 |
| 18 #if !defined(__has_feature) || !__has_feature(objc_arc) | 18 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 19 #error "This file requires ARC support." | 19 #error "This file requires ARC support." |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 #pragma mark - | 57 #pragma mark - |
| 58 #pragma mark InfoBarController | 58 #pragma mark InfoBarController |
| 59 | 59 |
| 60 - (UIView<InfoBarViewProtocol>*)viewForDelegate: | 60 - (UIView<InfoBarViewProtocol>*)viewForDelegate: |
| 61 (infobars::InfoBarDelegate*)delegate | 61 (infobars::InfoBarDelegate*)delegate |
| 62 frame:(CGRect)frame { | 62 frame:(CGRect)frame { |
| 63 UIView<InfoBarViewProtocol>* infoBarView; | 63 UIView<InfoBarViewProtocol>* infoBarView; |
| 64 _confirmInfobarDelegate = delegate->AsConfirmInfoBarDelegate(); | 64 _confirmInfobarDelegate = delegate->AsConfirmInfoBarDelegate(); |
| 65 infoBarView = | 65 infoBarView = |
| 66 ios::GetChromeBrowserProvider()->CreateInfoBarView(frame, self.delegate); | 66 [[InfoBarView alloc] initWithFrame:frame delegate:self.delegate]; |
| 67 // Model data. | 67 // Model data. |
| 68 gfx::Image modelIcon = _confirmInfobarDelegate->GetIcon(); | 68 gfx::Image modelIcon = _confirmInfobarDelegate->GetIcon(); |
| 69 int buttons = _confirmInfobarDelegate->GetButtons(); | 69 int buttons = _confirmInfobarDelegate->GetButtons(); |
| 70 NSString* buttonOK = nil; | 70 NSString* buttonOK = nil; |
| 71 if (buttons & ConfirmInfoBarDelegate::BUTTON_OK) { | 71 if (buttons & ConfirmInfoBarDelegate::BUTTON_OK) { |
| 72 buttonOK = base::SysUTF16ToNSString(_confirmInfobarDelegate->GetButtonLabel( | 72 buttonOK = base::SysUTF16ToNSString(_confirmInfobarDelegate->GetButtonLabel( |
| 73 ConfirmInfoBarDelegate::BUTTON_OK)); | 73 ConfirmInfoBarDelegate::BUTTON_OK)); |
| 74 } | 74 } |
| 75 NSString* buttonCancel = nil; | 75 NSString* buttonCancel = nil; |
| 76 if (buttons & ConfirmInfoBarDelegate::BUTTON_CANCEL) { | 76 if (buttons & ConfirmInfoBarDelegate::BUTTON_CANCEL) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 if (!self.delegate) { | 155 if (!self.delegate) { |
| 156 return; | 156 return; |
| 157 } | 157 } |
| 158 if ([tag unsignedIntegerValue] == ConfirmInfoBarUITags::TITLE_LINK) { | 158 if ([tag unsignedIntegerValue] == ConfirmInfoBarUITags::TITLE_LINK) { |
| 159 _confirmInfobarDelegate->LinkClicked( | 159 _confirmInfobarDelegate->LinkClicked( |
| 160 WindowOpenDisposition::NEW_FOREGROUND_TAB); | 160 WindowOpenDisposition::NEW_FOREGROUND_TAB); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 @end | 164 @end |
| OLD | NEW |