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

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

Issue 2933833002: [iOS] Break retain cycle in InfoBars. (Closed)
Patch Set: Addressed comments. Created 3 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 | « no previous file | ios/chrome/browser/passwords/update_password_infobar_controller.mm » ('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 #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"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return; 111 return;
112 if (_confirmInfobarDelegate->GetLinkText().length()) { 112 if (_confirmInfobarDelegate->GetLinkText().length()) {
113 base::string16 msgLink = base::SysNSStringToUTF16([[view class] 113 base::string16 msgLink = base::SysNSStringToUTF16([[view class]
114 stringAsLink:base::SysUTF16ToNSString( 114 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 base::ReplaceFirstSubstringAfterOffset( 118 base::ReplaceFirstSubstringAfterOffset(
119 &messageText, 0, _confirmInfobarDelegate->GetLinkText(), msgLink); 119 &messageText, 0, _confirmInfobarDelegate->GetLinkText(), msgLink);
120 120
121 __weak ConfirmInfoBarController* weakSelf = self;
121 [view addLabel:base::SysUTF16ToNSString(messageText) 122 [view addLabel:base::SysUTF16ToNSString(messageText)
122 action:^(NSUInteger tag) { 123 action:^(NSUInteger tag) {
123 [self infobarLinkDidPress:tag]; 124 [weakSelf infobarLinkDidPress:tag];
124 }]; 125 }];
125 } else { 126 } else {
126 NSString* label = 127 NSString* label =
127 base::SysUTF16ToNSString(_confirmInfobarDelegate->GetMessageText()); 128 base::SysUTF16ToNSString(_confirmInfobarDelegate->GetMessageText());
128 [view addLabel:label]; 129 [view addLabel:label];
129 } 130 }
130 } 131 }
131 132
132 #pragma mark - Handling of User Events 133 #pragma mark - Handling of User Events
133 134
(...skipping 18 matching lines...) Expand all
152 if (!self.delegate) { 153 if (!self.delegate) {
153 return; 154 return;
154 } 155 }
155 if (tag == ConfirmInfoBarUITags::TITLE_LINK) { 156 if (tag == ConfirmInfoBarUITags::TITLE_LINK) {
156 _confirmInfobarDelegate->LinkClicked( 157 _confirmInfobarDelegate->LinkClicked(
157 WindowOpenDisposition::NEW_FOREGROUND_TAB); 158 WindowOpenDisposition::NEW_FOREGROUND_TAB);
158 } 159 }
159 } 160 }
160 161
161 @end 162 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/passwords/update_password_infobar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698