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

Unified Diff: ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h

Issue 2589803002: Upstream Chrome on iOS source code [6/11]. (Closed)
Patch Set: Created 4 years 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
Index: ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..1cc8598bde2fe80b48caa162267e447a480fd398
--- /dev/null
+++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h
@@ -0,0 +1,67 @@
+// Copyright 2016 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.
+
+#ifndef IOS_CHROME_BROWSER_UI_QR_SCANNER_QR_SCANNER_VIEW_H_
+#define IOS_CHROME_BROWSER_UI_QR_SCANNER_QR_SCANNER_VIEW_H_
+
+#import <AVFoundation/AVFoundation.h>
+#import <UIKit/UIKit.h>
+
+@protocol QRScannerViewDelegate
+
+// Called when the close button is pressed.
+- (void)dismissQRScannerView:(id)sender;
+// Called when the torch button is pressed.
+- (void)toggleTorch:(id)sender;
+
+@end
+
+// The view rendering the QR Scanner UI. The view contains the camera preview,
+// a semi-transparent overlay with a transparent viewport, border around the
+// viewport, the close and flash controls, and a label instructing the user to
+// correctly position the scanned code.
+@interface QRScannerView : UIView
+
+// The delegate which receives button events.
+@property(nonatomic, assign) id<QRScannerViewDelegate> delegate;
+
+- (instancetype)initWithFrame:(CGRect)frame
+ delegate:(id<QRScannerViewDelegate>)delegate
+ NS_DESIGNATED_INITIALIZER;
+
+- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
+
+- (instancetype)initWithCoder:(NSCoder*)coder NS_UNAVAILABLE;
+
+// Returns the displayed preview layer.
+- (AVCaptureVideoPreviewLayer*)getPreviewLayer;
+
+// Sets the state of the torch button to enabled or disabled according to the
+// value of |torchIsAvailable|.
+- (void)enableTorchButton:(BOOL)torchIsAvailable;
+
+// Sets the torch button icon to on or off based on the value of |torchIsOn|.
+- (void)setTorchButtonTo:(BOOL)torchIsOn;
+
+// Resets the frame of the preview layer to a CGRect with origin (0, 0) and
+// size equal to |size|.
+- (void)resetPreviewFrame:(CGSize)size;
+
+// Rotates the preview layer by |angle|. Used for a transform which prevents the
+// preview layer from rotating with the rest of the interface.
+- (void)rotatePreviewByAngle:(CGFloat)angle;
+
+// Rounds the parameters of the preview layer's transform.
+- (void)finishPreviewRotation;
+
+// Returns the rectangle in camera coordinates in which codes should be
+// recognized.
+- (CGRect)viewportRectOfInterest;
+
+// Display a flash animation when a result is scanned.
+- (void)animateScanningResultWithCompletion:(void (^)(void))completion;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_QR_SCANNER_QR_SCANNER_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698