| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ui/settings/sync_encryption_passphrase_collection_vi
ew_controller.h" | 5 #import "ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_vi
ew_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| 11 #import "base/mac/objc_property_releaser.h" | 11 #import "base/mac/objc_release_properties.h" |
| 12 #import "base/mac/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 #include "components/browser_sync/profile_sync_service.h" | 14 #include "components/browser_sync/profile_sync_service.h" |
| 15 #include "components/google/core/browser/google_util.h" | 15 #include "components/google/core/browser/google_util.h" |
| 16 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 16 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 17 #import "components/signin/ios/browser/oauth2_token_service_observer_bridge.h" | 17 #import "components/signin/ios/browser/oauth2_token_service_observer_bridge.h" |
| 18 #include "components/strings/grit/components_strings.h" | 18 #include "components/strings/grit/components_strings.h" |
| 19 #include "ios/chrome/browser/application_context.h" | 19 #include "ios/chrome/browser/application_context.h" |
| 20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 21 #include "ios/chrome/browser/chrome_url_constants.h" | 21 #include "ios/chrome/browser/chrome_url_constants.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 OAuth2TokenServiceObserverBridgeDelegate, | 58 OAuth2TokenServiceObserverBridgeDelegate, |
| 59 SettingsControllerProtocol> { | 59 SettingsControllerProtocol> { |
| 60 ios::ChromeBrowserState* browserState_; | 60 ios::ChromeBrowserState* browserState_; |
| 61 // Whether the decryption progress is currently being shown. | 61 // Whether the decryption progress is currently being shown. |
| 62 BOOL isDecryptionProgressShown_; | 62 BOOL isDecryptionProgressShown_; |
| 63 base::scoped_nsobject<NSString> savedTitle_; | 63 base::scoped_nsobject<NSString> savedTitle_; |
| 64 base::scoped_nsobject<UIBarButtonItem> savedLeftButton_; | 64 base::scoped_nsobject<UIBarButtonItem> savedLeftButton_; |
| 65 std::unique_ptr<SyncObserverBridge> syncObserver_; | 65 std::unique_ptr<SyncObserverBridge> syncObserver_; |
| 66 std::unique_ptr<OAuth2TokenServiceObserverBridge> tokenServiceObserver_; | 66 std::unique_ptr<OAuth2TokenServiceObserverBridge> tokenServiceObserver_; |
| 67 base::scoped_nsobject<UITextField> passphrase_; | 67 base::scoped_nsobject<UITextField> passphrase_; |
| 68 base::mac::ObjCPropertyReleaser | |
| 69 propertyReleaser_SyncEncryptionPassphraseCollectionViewController_; | |
| 70 } | 68 } |
| 71 | 69 |
| 72 // Sets up the navigation bar's right button. The button will be enabled iff | 70 // Sets up the navigation bar's right button. The button will be enabled iff |
| 73 // |-areAllFieldsFilled| returns YES. | 71 // |-areAllFieldsFilled| returns YES. |
| 74 - (void)setRightNavBarItem; | 72 - (void)setRightNavBarItem; |
| 75 | 73 |
| 76 // Returns a passphrase message item. | 74 // Returns a passphrase message item. |
| 77 - (CollectionViewItem*)passphraseMessageItem; | 75 - (CollectionViewItem*)passphraseMessageItem; |
| 78 | 76 |
| 79 // Returns a passphrase item. | 77 // Returns a passphrase item. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 self.headerMessage = | 133 self.headerMessage = |
| 136 l10n_util::GetNSString(IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY); | 134 l10n_util::GetNSString(IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY); |
| 137 } | 135 } |
| 138 self.processingMessage = l10n_util::GetNSString(IDS_SYNC_LOGIN_SETTING_UP); | 136 self.processingMessage = l10n_util::GetNSString(IDS_SYNC_LOGIN_SETTING_UP); |
| 139 footerMessage_ = | 137 footerMessage_ = |
| 140 [l10n_util::GetNSString(IDS_IOS_SYNC_PASSPHRASE_RECOVER) retain]; | 138 [l10n_util::GetNSString(IDS_IOS_SYNC_PASSPHRASE_RECOVER) retain]; |
| 141 | 139 |
| 142 tokenServiceObserver_.reset(new OAuth2TokenServiceObserverBridge( | 140 tokenServiceObserver_.reset(new OAuth2TokenServiceObserverBridge( |
| 143 OAuth2TokenServiceFactory::GetForBrowserState(browserState_), self)); | 141 OAuth2TokenServiceFactory::GetForBrowserState(browserState_), self)); |
| 144 | 142 |
| 145 propertyReleaser_SyncEncryptionPassphraseCollectionViewController_.Init( | |
| 146 self, [SyncEncryptionPassphraseCollectionViewController class]); | |
| 147 | |
| 148 [self loadModel]; | 143 [self loadModel]; |
| 149 } | 144 } |
| 150 return self; | 145 return self; |
| 151 } | 146 } |
| 152 | 147 |
| 148 - (void)dealloc { |
| 149 base::mac::ReleaseProperties(self); |
| 150 [super dealloc]; |
| 151 } |
| 152 |
| 153 - (UITextField*)passphrase { | 153 - (UITextField*)passphrase { |
| 154 return passphrase_; | 154 return passphrase_; |
| 155 } | 155 } |
| 156 | 156 |
| 157 - (NSString*)syncErrorMessage { | 157 - (NSString*)syncErrorMessage { |
| 158 if (syncErrorMessage_) | 158 if (syncErrorMessage_) |
| 159 return syncErrorMessage_; | 159 return syncErrorMessage_; |
| 160 SyncSetupService* service = | 160 SyncSetupService* service = |
| 161 SyncSetupServiceFactory::GetForBrowserState(browserState_); | 161 SyncSetupServiceFactory::GetForBrowserState(browserState_); |
| 162 DCHECK(service); | 162 DCHECK(service); |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 self.navigationController) popViewControllerOrCloseSettingsAnimated:NO]; | 571 self.navigationController) popViewControllerOrCloseSettingsAnimated:NO]; |
| 572 } | 572 } |
| 573 | 573 |
| 574 #pragma mark - SettingsControllerProtocol callbacks | 574 #pragma mark - SettingsControllerProtocol callbacks |
| 575 | 575 |
| 576 - (void)settingsWillBeDismissed { | 576 - (void)settingsWillBeDismissed { |
| 577 [self stopObserving]; | 577 [self stopObserving]; |
| 578 } | 578 } |
| 579 | 579 |
| 580 @end | 580 @end |
| OLD | NEW |