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