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

Side by Side Diff: ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.mm

Issue 2912373002: [iOS] Stop swizzling the |init| method of CameraController. (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.h" 5 #import "ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.h"
6 6
7 #import <AVFoundation/AVFoundation.h> 7 #import <AVFoundation/AVFoundation.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/user_metrics.h" 10 #include "base/metrics/user_metrics.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 @synthesize delegate = _delegate; 75 @synthesize delegate = _delegate;
76 76
77 #pragma mark lifecycle 77 #pragma mark lifecycle
78 78
79 - (instancetype)initWithDelegate:(id<QRScannerViewControllerDelegate>)delegate { 79 - (instancetype)initWithDelegate:(id<QRScannerViewControllerDelegate>)delegate {
80 self = [super initWithNibName:nil bundle:nil]; 80 self = [super initWithNibName:nil bundle:nil];
81 if (self) { 81 if (self) {
82 DCHECK(delegate); 82 DCHECK(delegate);
83 _delegate = delegate; 83 _delegate = delegate;
84 _cameraController = [[CameraController alloc] initWithDelegate:self]; 84 _cameraController = [CameraController cameraControllerWithDelegate:self];
85 } 85 }
86 return self; 86 return self;
87 } 87 }
88 88
89 - (instancetype)initWithNibName:(NSString*)name bundle:(NSBundle*)bundle { 89 - (instancetype)initWithNibName:(NSString*)name bundle:(NSBundle*)bundle {
90 NOTREACHED(); 90 NOTREACHED();
91 return nil; 91 return nil;
92 } 92 }
93 93
94 - (instancetype)initWithCoder:(NSCoder*)coder { 94 - (instancetype)initWithCoder:(NSCoder*)coder {
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 - (void)toggleTorch:(id)sender { 362 - (void)toggleTorch:(id)sender {
363 if ([_cameraController isTorchActive]) { 363 if ([_cameraController isTorchActive]) {
364 [self setTorchMode:AVCaptureTorchModeOff]; 364 [self setTorchMode:AVCaptureTorchModeOff];
365 } else { 365 } else {
366 base::RecordAction(UserMetricsAction("MobileQRScannerTorchOn")); 366 base::RecordAction(UserMetricsAction("MobileQRScannerTorchOn"));
367 [self setTorchMode:AVCaptureTorchModeOn]; 367 [self setTorchMode:AVCaptureTorchModeOn];
368 } 368 }
369 } 369 }
370 370
371 @end 371 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698