| 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 "ios/chrome/browser/infobars/confirm_infobar_controller.h" | 5 #include "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" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 - (void)updateInfobarLabel:(UIView<InfoBarViewProtocol>*)view { | 109 - (void)updateInfobarLabel:(UIView<InfoBarViewProtocol>*)view { |
| 110 if (!confirmInfobarDelegate_->GetMessageText().length()) | 110 if (!confirmInfobarDelegate_->GetMessageText().length()) |
| 111 return; | 111 return; |
| 112 if (confirmInfobarDelegate_->GetLinkText().length()) { | 112 if (confirmInfobarDelegate_->GetLinkText().length()) { |
| 113 base::string16 msgLink = base::SysNSStringToUTF16( | 113 base::string16 msgLink = base::SysNSStringToUTF16( |
| 114 [[view class] stringAsLink:base::SysUTF16ToNSString( | 114 [[view class] stringAsLink:base::SysUTF16ToNSString( |
| 115 confirmInfobarDelegate_->GetLinkText()) | 115 confirmInfobarDelegate_->GetLinkText()) |
| 116 tag:ConfirmInfoBarUITags::TITLE_LINK]); | 116 tag:ConfirmInfoBarUITags::TITLE_LINK]); |
| 117 base::string16 messageText = confirmInfobarDelegate_->GetMessageText(); | 117 base::string16 messageText = confirmInfobarDelegate_->GetMessageText(); |
| 118 ReplaceFirstSubstringAfterOffset( | 118 base::ReplaceFirstSubstringAfterOffset( |
| 119 &messageText, 0, confirmInfobarDelegate_->GetLinkText(), msgLink); | 119 &messageText, 0, confirmInfobarDelegate_->GetLinkText(), msgLink); |
| 120 | 120 |
| 121 [view addLabel:base::SysUTF16ToNSString(messageText) | 121 [view addLabel:base::SysUTF16ToNSString(messageText) |
| 122 target:self | 122 target:self |
| 123 action:@selector(infobarLinkDidPress:)]; | 123 action:@selector(infobarLinkDidPress:)]; |
| 124 } else { | 124 } else { |
| 125 NSString* label = | 125 NSString* label = |
| 126 base::SysUTF16ToNSString(confirmInfobarDelegate_->GetMessageText()); | 126 base::SysUTF16ToNSString(confirmInfobarDelegate_->GetMessageText()); |
| 127 [view addLabel:label]; | 127 [view addLabel:label]; |
| 128 } | 128 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 151 DCHECK([tag isKindOfClass:[NSNumber class]]); | 151 DCHECK([tag isKindOfClass:[NSNumber class]]); |
| 152 if (!self.delegate) { | 152 if (!self.delegate) { |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 if ([tag unsignedIntegerValue] == ConfirmInfoBarUITags::TITLE_LINK) { | 155 if ([tag unsignedIntegerValue] == ConfirmInfoBarUITags::TITLE_LINK) { |
| 156 confirmInfobarDelegate_->LinkClicked(NEW_FOREGROUND_TAB); | 156 confirmInfobarDelegate_->LinkClicked(NEW_FOREGROUND_TAB); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 @end | 160 @end |
| OLD | NEW |