MSE: Remap single text track number changes in frame processor
[chromium-blink-merge.git] / remoting / ios / ui / pin_entry_view_controller.mm
blob9a37677a504787781a09f56da662607a3d3c5566
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.
5 #if !defined(__has_feature) || !__has_feature(objc_arc)
6 #error "This file requires ARC support."
7 #endif
9 #import "remoting/ios/ui/pin_entry_view_controller.h"
11 #import "remoting/ios/utility.h"
13 @implementation PinEntryViewController
15 @synthesize delegate = _delegate;
16 @synthesize shouldPrompt = _shouldPrompt;
17 @synthesize pairingSupported = _pairingSupported;
19 // Override UIViewController
20 - (id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil {
21   // NibName is the * part of your *.xib file
23   if ([Utility isPad]) {
24     self = [super initWithNibName:@"pin_entry_view_controller_ipad" bundle:nil];
25   } else {
26     self =
27         [super initWithNibName:@"pin_entry_view_controller_iphone" bundle:nil];
28   }
29   if (self) {
30     // Custom initialization
31   }
32   return self;
35 // Override UIViewController
36 // Controls are not created immediately, properties must be set before the form
37 // is displayed
38 - (void)viewWillAppear:(BOOL)animated {
39   _host.text = _hostName;
41   [_switchAskAgain setOn:!_shouldPrompt];
43   // TODO (aboone) The switch is being hidden in all cases, this functionality
44   // is not scheduled for QA yet.
45   // if (!_pairingSupported) {
46   _switchAskAgain.hidden = YES;
47   _shouldSavePin.hidden = YES;
48   _switchAskAgain.enabled = NO;
49   //}
50   [_hostPin becomeFirstResponder];
53 // @protocol UITextFieldDelegate, called when the 'enter' key is pressed
54 - (BOOL)textFieldShouldReturn:(UITextField*)textField {
55   [textField resignFirstResponder];
56   if (textField == _hostPin)
57     [self buttonConnectClicked:self];
58   return YES;
61 - (IBAction)buttonCancelClicked:(id)sender {
62   [_delegate cancelledConnectToHostWithPin:self];
65 - (IBAction)buttonConnectClicked:(id)sender {
66   [_delegate connectToHostWithPin:self
67                           hostPin:_hostPin.text
68                      shouldPrompt:!_switchAskAgain.isOn];
71 @end