Home | History | Annotate | Download | only in ui
      1 // Copyright 2014 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 REMOTING_IOS_UI_PIN_ENTRY_VIEW_CONTROLLER_H_
      6 #define REMOTING_IOS_UI_PIN_ENTRY_VIEW_CONTROLLER_H_
      7 
      8 #import <UIKit/UIKit.h>
      9 
     10 // Contract to handle finalization for Pin Prompt
     11 @protocol PinEntryViewControllerDelegate<NSObject>
     12 
     13 // Returns with user's Pin.  Pin has not been validated with the server yet.
     14 // |shouldPrompt| indicates whether a prompt should be needed for the next login
     15 // attempt with this host.
     16 - (void)connectToHostWithPin:(UIViewController*)controller
     17                      hostPin:(NSString*)hostPin
     18                 shouldPrompt:(BOOL)shouldPrompt;
     19 
     20 // Returns when the user has cancelled the input, effectively closing the
     21 // connection attempt.
     22 - (void)cancelledConnectToHostWithPin:(UIViewController*)controller;
     23 
     24 @end
     25 
     26 // Dialog for user's Pin input. If a host has |pairingSupported| then user has
     27 // the option to save a token for authentication.
     28 @interface PinEntryViewController : UIViewController<UITextFieldDelegate> {
     29  @private
     30   IBOutlet UIView* _controlView;
     31   IBOutlet UIButton* _cancelButton;
     32   IBOutlet UIButton* _connectButton;
     33   IBOutlet UILabel* _host;
     34   IBOutlet UISwitch* _switchAskAgain;
     35   IBOutlet UILabel* _shouldSavePin;
     36   IBOutlet UITextField* _hostPin;
     37 }
     38 
     39 @property(weak, nonatomic) id<PinEntryViewControllerDelegate> delegate;
     40 @property(nonatomic, copy) NSString* hostName;
     41 @property(nonatomic) BOOL shouldPrompt;
     42 @property(nonatomic) BOOL pairingSupported;
     43 
     44 - (IBAction)buttonCancelClicked:(id)sender;
     45 - (IBAction)buttonConnectClicked:(id)sender;
     46 
     47 @end
     48 
     49 #endif  // REMOTING_IOS_UI_PIN_ENTRY_VIEW_CONTROLLER_H_