| OLD | NEW |
| 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 #include "base/mac/objc_release_properties.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.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 | |
| 23 _propertyReleaser_UpdatePasswordInfoBarController; | |
| 24 IOSChromeUpdatePasswordInfoBarDelegate* _delegate; | 22 IOSChromeUpdatePasswordInfoBarDelegate* _delegate; |
| 25 } | 23 } |
| 26 @property(nonatomic, retain) SelectorCoordinator* selectorCoordinator; | 24 @property(nonatomic, retain) SelectorCoordinator* selectorCoordinator; |
| 27 @end | 25 @end |
| 28 | 26 |
| 29 @implementation UpdatePasswordInfoBarController | 27 @implementation UpdatePasswordInfoBarController |
| 30 | 28 |
| 31 @synthesize selectorCoordinator = _selectorCoordinator; | 29 @synthesize selectorCoordinator = _selectorCoordinator; |
| 32 | 30 |
| 33 - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate { | 31 - (void)dealloc { |
| 34 self = [super initWithDelegate:delegate]; | 32 base::mac::ReleaseProperties(self); |
| 35 if (self) { | 33 [super dealloc]; |
| 36 _propertyReleaser_UpdatePasswordInfoBarController.Init( | |
| 37 self, [UpdatePasswordInfoBarController class]); | |
| 38 } | |
| 39 return self; | |
| 40 } | 34 } |
| 41 | 35 |
| 42 - (InfoBarView*)viewForDelegate: | 36 - (InfoBarView*)viewForDelegate: |
| 43 (IOSChromeUpdatePasswordInfoBarDelegate*)delegate | 37 (IOSChromeUpdatePasswordInfoBarDelegate*)delegate |
| 44 frame:(CGRect)frame { | 38 frame:(CGRect)frame { |
| 45 _delegate = delegate; | 39 _delegate = delegate; |
| 46 return [super viewForDelegate:delegate frame:frame]; | 40 return [super viewForDelegate:delegate frame:frame]; |
| 47 } | 41 } |
| 48 | 42 |
| 49 - (void)updateInfobarLabel:(InfoBarView*)view { | 43 - (void)updateInfobarLabel:(InfoBarView*)view { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 80 |
| 87 #pragma mark SelectorCoordinatorDelegate | 81 #pragma mark SelectorCoordinatorDelegate |
| 88 | 82 |
| 89 - (void)selectorCoordinator:(SelectorCoordinator*)coordinator | 83 - (void)selectorCoordinator:(SelectorCoordinator*)coordinator |
| 90 didCompleteWithSelection:(NSString*)selection { | 84 didCompleteWithSelection:(NSString*)selection { |
| 91 _delegate->set_selected_account(base::SysNSStringToUTF16(selection)); | 85 _delegate->set_selected_account(base::SysNSStringToUTF16(selection)); |
| 92 [self updateInfobarLabel:self.view]; | 86 [self updateInfobarLabel:self.view]; |
| 93 } | 87 } |
| 94 | 88 |
| 95 @end | 89 @end |
| OLD | NEW |