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; | |
16 BOOL _launchVoiceSearch; | 18 BOOL _launchVoiceSearch; |
17 BOOL _launchInIncognito; | 19 BOOL _launchInIncognito; |
18 BOOL _launchQRScanner; | 20 BOOL _launchQRScanner; |
19 } | 21 } |
20 | 22 |
21 @synthesize launchVoiceSearch = _launchVoiceSearch; | 23 @synthesize launchVoiceSearch = _launchVoiceSearch; |
22 @synthesize launchInIncognito = _launchInIncognito; | 24 @synthesize launchInIncognito = _launchInIncognito; |
| 25 @synthesize xCallbackParameters = _xCallbackParameters; |
23 | 26 |
24 - (const GURL&)externalURL { | 27 - (const GURL&)externalURL { |
25 return _externalURL; | 28 return _externalURL; |
26 } | 29 } |
27 | 30 |
28 - (XCallbackParameters*)xCallbackParameters { | |
29 return _xCallbackParameters.get(); | |
30 } | |
31 | 31 |
32 - (instancetype)init { | 32 - (instancetype)init { |
33 NOTREACHED(); | 33 NOTREACHED(); |
34 return nil; | 34 return nil; |
35 } | 35 } |
36 | 36 |
37 - (instancetype)initWithExternalURL:(const GURL&)externalURL { | 37 - (instancetype)initWithExternalURL:(const GURL&)externalURL { |
38 return [self initWithExternalURL:externalURL xCallbackParameters:nil]; | 38 return [self initWithExternalURL:externalURL xCallbackParameters:nil]; |
39 } | 39 } |
40 | 40 |
41 - (instancetype)initWithExternalURL:(const GURL&)externalURL | 41 - (instancetype)initWithExternalURL:(const GURL&)externalURL |
42 xCallbackParameters:(XCallbackParameters*)xCallbackParameters { | 42 xCallbackParameters:(XCallbackParameters*)xCallbackParameters { |
43 self = [super init]; | 43 self = [super init]; |
44 if (self) { | 44 if (self) { |
45 _externalURL = GURL(externalURL); | 45 _externalURL = externalURL; |
46 _xCallbackParameters.reset([xCallbackParameters retain]); | 46 _xCallbackParameters = xCallbackParameters; |
47 } | 47 } |
48 return self; | 48 return self; |
49 } | 49 } |
50 | 50 |
51 - (NSString*)description { | 51 - (NSString*)description { |
52 return [NSString stringWithFormat:@"ExternalURL: %s \nXCallbackParams: %@", | 52 return [NSString stringWithFormat:@"ExternalURL: %s \nXCallbackParams: %@", |
53 _externalURL.spec().c_str(), | 53 _externalURL.spec().c_str(), |
54 _xCallbackParameters.get()]; | 54 _xCallbackParameters]; |
55 } | 55 } |
56 | 56 |
57 #pragma mark Property implementation. | 57 #pragma mark Property implementation. |
58 | 58 |
59 - (BOOL)launchQRScanner { | 59 - (BOOL)launchQRScanner { |
60 return _launchQRScanner && experimental_flags::IsQRCodeReaderEnabled(); | 60 return _launchQRScanner && experimental_flags::IsQRCodeReaderEnabled(); |
61 } | 61 } |
62 | 62 |
63 - (void)setLaunchQRScanner:(BOOL)launch { | 63 - (void)setLaunchQRScanner:(BOOL)launch { |
64 _launchQRScanner = launch; | 64 _launchQRScanner = launch; |
65 } | 65 } |
66 | 66 |
67 @end | 67 @end |
OLD | NEW |