OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_ENCRYPTION_PASSPHRASE_COLLECTION_VIE
W_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_ENCRYPTION_PASSPHRASE_COLLECTION_VIE
W_CONTROLLER_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #import "ios/chrome/browser/sync/sync_observer_bridge.h" |
| 11 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" |
| 12 #import "ios/chrome/browser/ui/settings/settings_root_collection_view_controller
.h" |
| 13 |
| 14 namespace ios { |
| 15 class ChromeBrowserState; |
| 16 } // namespace ios |
| 17 |
| 18 namespace ios_internal { |
| 19 namespace sync_encryption_passphrase { |
| 20 typedef NS_ENUM(NSInteger, SectionIdentifier) { |
| 21 SectionIdentifierPassphrase = kSectionIdentifierEnumZero, |
| 22 SectionIdentifierFooter, |
| 23 }; |
| 24 typedef NS_ENUM(NSInteger, ItemType) { |
| 25 ItemTypeMessage = kItemTypeEnumZero, |
| 26 ItemTypeEnterPassphrase, |
| 27 ItemTypeConfirmPassphrase, |
| 28 ItemTypeError, |
| 29 ItemTypeFooter, |
| 30 }; |
| 31 } // namespace sync_encryption_passphrase |
| 32 } // namespace ios_internal |
| 33 |
| 34 // Controller to allow user to specify encryption passphrase for Sync. |
| 35 @interface SyncEncryptionPassphraseCollectionViewController |
| 36 : SettingsRootCollectionViewController<SyncObserverModelBridge> |
| 37 |
| 38 @property(nonatomic, readonly) UITextField* passphrase; |
| 39 @property(nonatomic, copy) NSString* headerMessage; |
| 40 @property(nonatomic, copy) NSString* footerMessage; |
| 41 @property(nonatomic, copy) NSString* processingMessage; |
| 42 @property(nonatomic, copy) NSString* syncErrorMessage; |
| 43 |
| 44 // |browserState| must not be nil. |
| 45 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState |
| 46 NS_DESIGNATED_INITIALIZER; |
| 47 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style |
| 48 NS_UNAVAILABLE; |
| 49 |
| 50 @end |
| 51 |
| 52 @interface SyncEncryptionPassphraseCollectionViewController ( |
| 53 Subclassing)<UITextFieldDelegate> |
| 54 |
| 55 // Whether this controller is for encryption or decryption. Returns |YES|, if |
| 56 // the used for the user to enter an existing passphrase that is not yet |
| 57 // available on the device. Returns |NO| if the user is setting a new |
| 58 // passphrase. |
| 59 - (BOOL)forDecryption; |
| 60 |
| 61 // User has pressed the Sign In button. |
| 62 - (void)signInPressed; |
| 63 |
| 64 // Clears all fields after displaying an error. |
| 65 - (void)clearFieldsOnError:(NSString*)errorMessage; |
| 66 |
| 67 // Whether the text field(s) is(are) filled. |
| 68 - (BOOL)areAllFieldsFilled; |
| 69 |
| 70 // Registers listening to the events of |textField|. |
| 71 - (void)registerTextField:(UITextField*)textField; |
| 72 |
| 73 // Unregisters listening to the events of |textField|. |
| 74 - (void)unregisterTextField:(UITextField*)textField; |
| 75 |
| 76 // Called after a touch event entering a |UITextField|. |
| 77 - (void)textFieldDidBeginEditing:(id)sender; |
| 78 |
| 79 // Called after a touch event changing a |UITextField|. |
| 80 - (void)textFieldDidChange:(id)sender; |
| 81 |
| 82 // Called after a touch event leaving a |UITextField| by clicking "return" key. |
| 83 - (void)textFieldDidEndEditing:(id)sender; |
| 84 |
| 85 // Stops observing the sync service. This is required during the shutdown phase |
| 86 // to avoid observing sync events for a browser state that is being killed. |
| 87 - (void)stopObserving; |
| 88 |
| 89 @end |
| 90 |
| 91 #endif // IOS_CHROME_BROWSER_UI_SETTINGS_SYNC_ENCRYPTION_PASSPHRASE_COLLECTION_
VIEW_CONTROLLER_H_ |
OLD | NEW |