Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: ios/chrome/browser/infobars/confirm_infobar_controller.mm

Issue 1200393002: Add more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string
Patch Set: Android Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | mojo/runner/context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | mojo/runner/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698