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

Side by Side Diff: ios/chrome/browser/passwords/update_password_infobar_controller.mm

Issue 2592113002: Remove legacy InfoBarViewProtocol. (Closed)
Patch Set: Rebase. Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/passwords/update_password_infobar_controller.h" 5 #import "ios/chrome/browser/passwords/update_password_infobar_controller.h"
6 6
7 #import "base/mac/objc_property_releaser.h" 7 #import "base/mac/objc_property_releaser.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 "ios/chrome/browser/infobars/confirm_infobar_controller+protected.h" 10 #include "ios/chrome/browser/infobars/confirm_infobar_controller+protected.h"
11 #include "ios/chrome/browser/passwords/ios_chrome_update_password_infobar_delega te.h" 11 #include "ios/chrome/browser/passwords/ios_chrome_update_password_infobar_delega te.h"
12 #import "ios/chrome/browser/ui/elements/selector_coordinator.h" 12 #import "ios/chrome/browser/ui/elements/selector_coordinator.h"
13 #import "ios/chrome/browser/ui/infobars/infobar_view_protocol.h" 13 #import "ios/chrome/browser/ui/infobars/infobar_view.h"
14 14
15 namespace { 15 namespace {
16 // Tag for the account link in the info bar message. Set to 10 to avoid conflict 16 // Tag for the account link in the info bar message. Set to 10 to avoid conflict
17 // with tags from superclass ConfirmInfoBarController, which uses tags 1-4. 17 // with tags from superclass ConfirmInfoBarController, which uses tags 1-4.
18 NSUInteger kAccountTag = 10; 18 NSUInteger kAccountTag = 10;
19 } 19 }
20 20
21 @interface UpdatePasswordInfoBarController ()<SelectorCoordinatorDelegate> { 21 @interface UpdatePasswordInfoBarController ()<SelectorCoordinatorDelegate> {
22 base::mac::ObjCPropertyReleaser 22 base::mac::ObjCPropertyReleaser
23 _propertyReleaser_UpdatePasswordInfoBarController; 23 _propertyReleaser_UpdatePasswordInfoBarController;
24 IOSChromeUpdatePasswordInfoBarDelegate* _delegate; 24 IOSChromeUpdatePasswordInfoBarDelegate* _delegate;
25 } 25 }
26 @property(nonatomic, retain) SelectorCoordinator* selectorCoordinator; 26 @property(nonatomic, retain) SelectorCoordinator* selectorCoordinator;
27 @end 27 @end
28 28
29 @implementation UpdatePasswordInfoBarController 29 @implementation UpdatePasswordInfoBarController
30 30
31 @synthesize selectorCoordinator = _selectorCoordinator; 31 @synthesize selectorCoordinator = _selectorCoordinator;
32 32
33 - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate { 33 - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate {
34 self = [super initWithDelegate:delegate]; 34 self = [super initWithDelegate:delegate];
35 if (self) { 35 if (self) {
36 _propertyReleaser_UpdatePasswordInfoBarController.Init( 36 _propertyReleaser_UpdatePasswordInfoBarController.Init(
37 self, [UpdatePasswordInfoBarController class]); 37 self, [UpdatePasswordInfoBarController class]);
38 } 38 }
39 return self; 39 return self;
40 } 40 }
41 41
42 - (UIView<InfoBarViewProtocol>*) 42 - (InfoBarView*)viewForDelegate:
43 viewForDelegate:(IOSChromeUpdatePasswordInfoBarDelegate*)delegate 43 (IOSChromeUpdatePasswordInfoBarDelegate*)delegate
44 frame:(CGRect)frame { 44 frame:(CGRect)frame {
45 _delegate = delegate; 45 _delegate = delegate;
46 return [super viewForDelegate:delegate frame:frame]; 46 return [super viewForDelegate:delegate frame:frame];
47 } 47 }
48 48
49 - (void)updateInfobarLabel:(UIView<InfoBarViewProtocol>*)view { 49 - (void)updateInfobarLabel:(InfoBarView*)view {
50 [super updateInfobarLabel:view]; 50 [super updateInfobarLabel:view];
51 51
52 // Get the message text with current links marked. 52 // Get the message text with current links marked.
53 base::string16 messageText = base::SysNSStringToUTF16(view.markedLabel); 53 base::string16 messageText = base::SysNSStringToUTF16(view.markedLabel);
54 // If there are multiple possible credentials, turn the account string into a 54 // If there are multiple possible credentials, turn the account string into a
55 // link. 55 // link.
56 if (_delegate->ShowMultipleAccounts()) { 56 if (_delegate->ShowMultipleAccounts()) {
57 base::string16 usernameLink = base::SysNSStringToUTF16([[view class] 57 base::string16 usernameLink = base::SysNSStringToUTF16([[view class]
58 stringAsLink:base::SysUTF16ToNSString(_delegate->selected_account()) 58 stringAsLink:base::SysUTF16ToNSString(_delegate->selected_account())
59 tag:kAccountTag]); 59 tag:kAccountTag]);
(...skipping 25 matching lines...) Expand all
85 85
86 #pragma mark SelectorCoordinatorDelegate 86 #pragma mark SelectorCoordinatorDelegate
87 87
88 - (void)selectorCoordinator:(SelectorCoordinator*)coordinator 88 - (void)selectorCoordinator:(SelectorCoordinator*)coordinator
89 didCompleteWithSelection:(NSString*)selection { 89 didCompleteWithSelection:(NSString*)selection {
90 _delegate->set_selected_account(base::SysNSStringToUTF16(selection)); 90 _delegate->set_selected_account(base::SysNSStringToUTF16(selection));
91 [self updateInfobarLabel:self.view]; 91 [self updateInfobarLabel:self.view];
92 } 92 }
93 93
94 @end 94 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698