Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/app_startup_parameters.h" | 5 #import "ios/chrome/browser/app_startup_parameters.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/mac/scoped_nsobject.h" | |
| 9 #include "ios/chrome/browser/experimental_flags.h" | 8 #include "ios/chrome/browser/experimental_flags.h" |
| 10 #import "ios/chrome/browser/xcallback_parameters.h" | 9 #import "ios/chrome/browser/xcallback_parameters.h" |
| 11 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| 12 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 13 #error "This file requires ARC support." | |
| 14 #endif | |
| 15 | |
| 13 @implementation AppStartupParameters { | 16 @implementation AppStartupParameters { |
| 14 GURL _externalURL; | 17 GURL _externalURL; |
| 15 base::scoped_nsobject<XCallbackParameters> _xCallbackParameters; | 18 XCallbackParameters* _xCallbackParameters; |
| 16 BOOL _launchVoiceSearch; | 19 BOOL _launchVoiceSearch; |
| 17 BOOL _launchInIncognito; | 20 BOOL _launchInIncognito; |
| 18 BOOL _launchQRScanner; | 21 BOOL _launchQRScanner; |
| 19 } | 22 } |
| 20 | 23 |
| 21 @synthesize launchVoiceSearch = _launchVoiceSearch; | 24 @synthesize launchVoiceSearch = _launchVoiceSearch; |
| 22 @synthesize launchInIncognito = _launchInIncognito; | 25 @synthesize launchInIncognito = _launchInIncognito; |
| 23 | 26 |
| 24 - (const GURL&)externalURL { | 27 - (const GURL&)externalURL { |
| 25 return _externalURL; | 28 return _externalURL; |
| 26 } | 29 } |
| 27 | 30 |
| 28 - (XCallbackParameters*)xCallbackParameters { | 31 - (XCallbackParameters*)xCallbackParameters { |
|
sdefresne
2016/12/12 19:37:00
You can synthesize this property:
@synthesize xCa
stkhapugin
2016/12/13 13:31:11
Done.
| |
| 29 return _xCallbackParameters.get(); | 32 return _xCallbackParameters; |
| 30 } | 33 } |
| 31 | 34 |
| 32 - (instancetype)init { | 35 - (instancetype)init { |
| 33 NOTREACHED(); | 36 NOTREACHED(); |
| 34 return nil; | 37 return nil; |
| 35 } | 38 } |
| 36 | 39 |
| 37 - (instancetype)initWithExternalURL:(const GURL&)externalURL { | 40 - (instancetype)initWithExternalURL:(const GURL&)externalURL { |
| 38 return [self initWithExternalURL:externalURL xCallbackParameters:nil]; | 41 return [self initWithExternalURL:externalURL xCallbackParameters:nil]; |
| 39 } | 42 } |
| 40 | 43 |
| 41 - (instancetype)initWithExternalURL:(const GURL&)externalURL | 44 - (instancetype)initWithExternalURL:(const GURL&)externalURL |
| 42 xCallbackParameters:(XCallbackParameters*)xCallbackParameters { | 45 xCallbackParameters:(XCallbackParameters*)xCallbackParameters { |
| 43 self = [super init]; | 46 self = [super init]; |
| 44 if (self) { | 47 if (self) { |
| 45 _externalURL = GURL(externalURL); | 48 _externalURL = GURL(externalURL); |
|
sdefresne
2016/12/12 19:37:00
nit: no need to invoke a copy constructor here, ju
stkhapugin
2016/12/13 13:31:11
Done.
| |
| 46 _xCallbackParameters.reset([xCallbackParameters retain]); | 49 _xCallbackParameters = xCallbackParameters; |
| 47 } | 50 } |
| 48 return self; | 51 return self; |
| 49 } | 52 } |
| 50 | 53 |
| 51 - (NSString*)description { | 54 - (NSString*)description { |
| 52 return [NSString stringWithFormat:@"ExternalURL: %s \nXCallbackParams: %@", | 55 return [NSString stringWithFormat:@"ExternalURL: %s \nXCallbackParams: %@", |
| 53 _externalURL.spec().c_str(), | 56 _externalURL.spec().c_str(), |
| 54 _xCallbackParameters.get()]; | 57 _xCallbackParameters]; |
| 55 } | 58 } |
| 56 | 59 |
| 57 #pragma mark Property implementation. | 60 #pragma mark Property implementation. |
| 58 | 61 |
| 59 - (BOOL)launchQRScanner { | 62 - (BOOL)launchQRScanner { |
| 60 return _launchQRScanner && experimental_flags::IsQRCodeReaderEnabled(); | 63 return _launchQRScanner && experimental_flags::IsQRCodeReaderEnabled(); |
| 61 } | 64 } |
| 62 | 65 |
| 63 - (void)setLaunchQRScanner:(BOOL)launch { | 66 - (void)setLaunchQRScanner:(BOOL)launch { |
| 64 _launchQRScanner = launch; | 67 _launchQRScanner = launch; |
| 65 } | 68 } |
| 66 | 69 |
| 67 @end | 70 @end |
| OLD | NEW |