OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_QR_SCANNER_QR_SCANNER_VIEW_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_QR_SCANNER_QR_SCANNER_VIEW_CONTROLLER_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #include "ios/chrome/browser/ui/qr_scanner/camera_controller.h" |
| 11 |
| 12 @protocol QRScannerViewControllerDelegate |
| 13 |
| 14 // Called when the scanner detects a valid code. Camera recording is stopped |
| 15 // when a result is scanned and the QRScannerViewController is dismissed. This |
| 16 // function is called when the dismissal completes. A valid code is any |
| 17 // non-empty string. If |load| is YES, the scanned code was of a type which can |
| 18 // only encode digits, and the delegate can load the result immediately, instead |
| 19 // of prompting the user to confirm the result. |
| 20 - (void)receiveQRScannerResult:(NSString*)qrScannerResult |
| 21 loadImmediately:(BOOL)load; |
| 22 |
| 23 @end |
| 24 |
| 25 @interface QRScannerViewController : UIViewController<CameraControllerDelegate> |
| 26 |
| 27 // The delegate which receives the scanned result after the view controller is |
| 28 // dismissed. |
| 29 @property(nonatomic, assign) id<QRScannerViewControllerDelegate> delegate; |
| 30 |
| 31 - (instancetype)initWithDelegate:(id<QRScannerViewControllerDelegate>)delegate |
| 32 NS_DESIGNATED_INITIALIZER; |
| 33 |
| 34 - (instancetype)initWithNibName:(NSString*)name |
| 35 bundle:(NSBundle*)bundle NS_UNAVAILABLE; |
| 36 |
| 37 - (instancetype)initWithCoder:(NSCoder*)coder NS_UNAVAILABLE; |
| 38 |
| 39 // Returns a view controller to be presented based on the camera state. Returns |
| 40 // |self| if the camera is available or an appropriate UIAlertController if |
| 41 // there was an error loading the camera. |
| 42 - (UIViewController*)getViewControllerToPresent; |
| 43 |
| 44 @end |
| 45 |
| 46 #endif // IOS_CHROME_BROWSER_UI_QR_SCANNER_QR_SCANNER_VIEW_CONTROLLER_H_ |
OLD | NEW |