Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1327)

Unified Diff: remoting/ios/ui/pin_entry_view_controller.mm

Issue 186733007: iOS Chromoting Client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/ios/ui/pin_entry_view_controller.h ('k') | remoting/ios/ui/pin_entry_view_controller_ipad.xib » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/ios/ui/pin_entry_view_controller.mm
diff --git a/remoting/ios/ui/pin_entry_view_controller.mm b/remoting/ios/ui/pin_entry_view_controller.mm
new file mode 100644
index 0000000000000000000000000000000000000000..9a37677a504787781a09f56da662607a3d3c5566
--- /dev/null
+++ b/remoting/ios/ui/pin_entry_view_controller.mm
@@ -0,0 +1,71 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+#import "remoting/ios/ui/pin_entry_view_controller.h"
+
+#import "remoting/ios/utility.h"
+
+@implementation PinEntryViewController
+
+@synthesize delegate = _delegate;
+@synthesize shouldPrompt = _shouldPrompt;
+@synthesize pairingSupported = _pairingSupported;
+
+// Override UIViewController
+- (id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil {
+ // NibName is the * part of your *.xib file
+
+ if ([Utility isPad]) {
+ self = [super initWithNibName:@"pin_entry_view_controller_ipad" bundle:nil];
+ } else {
+ self =
+ [super initWithNibName:@"pin_entry_view_controller_iphone" bundle:nil];
+ }
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+// Override UIViewController
+// Controls are not created immediately, properties must be set before the form
+// is displayed
+- (void)viewWillAppear:(BOOL)animated {
+ _host.text = _hostName;
+
+ [_switchAskAgain setOn:!_shouldPrompt];
+
+ // TODO (aboone) The switch is being hidden in all cases, this functionality
+ // is not scheduled for QA yet.
+ // if (!_pairingSupported) {
+ _switchAskAgain.hidden = YES;
+ _shouldSavePin.hidden = YES;
+ _switchAskAgain.enabled = NO;
+ //}
+ [_hostPin becomeFirstResponder];
+}
+
+// @protocol UITextFieldDelegate, called when the 'enter' key is pressed
+- (BOOL)textFieldShouldReturn:(UITextField*)textField {
+ [textField resignFirstResponder];
+ if (textField == _hostPin)
+ [self buttonConnectClicked:self];
+ return YES;
+}
+
+- (IBAction)buttonCancelClicked:(id)sender {
+ [_delegate cancelledConnectToHostWithPin:self];
+}
+
+- (IBAction)buttonConnectClicked:(id)sender {
+ [_delegate connectToHostWithPin:self
+ hostPin:_hostPin.text
+ shouldPrompt:!_switchAskAgain.isOn];
+}
+
+@end
« no previous file with comments | « remoting/ios/ui/pin_entry_view_controller.h ('k') | remoting/ios/ui/pin_entry_view_controller_ipad.xib » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698