| 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" | |
| 8 #import "ios/chrome/browser/xcallback_parameters.h" | |
| 9 #include "url/gurl.h" | 7 #include "url/gurl.h" |
| 10 | 8 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) | 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." | 10 #error "This file requires ARC support." |
| 13 #endif | 11 #endif |
| 14 | 12 |
| 15 @implementation AppStartupParameters { | 13 @implementation AppStartupParameters { |
| 16 GURL _externalURL; | 14 GURL _externalURL; |
| 17 } | 15 } |
| 18 | 16 |
| 19 @synthesize launchVoiceSearch = _launchVoiceSearch; | 17 @synthesize launchVoiceSearch = _launchVoiceSearch; |
| 20 @synthesize launchInIncognito = _launchInIncognito; | 18 @synthesize launchInIncognito = _launchInIncognito; |
| 21 @synthesize xCallbackParameters = _xCallbackParameters; | |
| 22 @synthesize launchFocusOmnibox = _launchFocusOmnibox; | 19 @synthesize launchFocusOmnibox = _launchFocusOmnibox; |
| 23 @synthesize launchQRScanner = _launchQRScanner; | 20 @synthesize launchQRScanner = _launchQRScanner; |
| 24 | 21 |
| 25 - (const GURL&)externalURL { | 22 - (const GURL&)externalURL { |
| 26 return _externalURL; | 23 return _externalURL; |
| 27 } | 24 } |
| 28 | 25 |
| 29 | |
| 30 - (instancetype)init { | |
| 31 NOTREACHED(); | |
| 32 return nil; | |
| 33 } | |
| 34 | |
| 35 - (instancetype)initWithExternalURL:(const GURL&)externalURL { | 26 - (instancetype)initWithExternalURL:(const GURL&)externalURL { |
| 36 return [self initWithExternalURL:externalURL xCallbackParameters:nil]; | |
| 37 } | |
| 38 | |
| 39 - (instancetype)initWithExternalURL:(const GURL&)externalURL | |
| 40 xCallbackParameters:(XCallbackParameters*)xCallbackParameters { | |
| 41 self = [super init]; | 27 self = [super init]; |
| 42 if (self) { | 28 if (self) { |
| 43 _externalURL = externalURL; | 29 _externalURL = externalURL; |
| 44 _xCallbackParameters = xCallbackParameters; | |
| 45 } | 30 } |
| 46 return self; | 31 return self; |
| 47 } | 32 } |
| 48 | 33 |
| 49 - (NSString*)description { | 34 - (NSString*)description { |
| 50 NSMutableString* description = [NSMutableString | 35 NSMutableString* description = |
| 51 stringWithFormat:@"ExternalURL: %s \nXCallbackParams: %@", | 36 [NSMutableString stringWithFormat:@"AppStartupParameters: %s", |
| 52 _externalURL.spec().c_str(), _xCallbackParameters]; | 37 _externalURL.spec().c_str()]; |
| 53 | 38 |
| 54 if (self.launchQRScanner) { | 39 if (self.launchQRScanner) { |
| 55 [description appendString:@", should launch QR scanner"]; | 40 [description appendString:@", should launch QR scanner"]; |
| 56 } | 41 } |
| 57 | 42 |
| 58 if (self.launchInIncognito) { | 43 if (self.launchInIncognito) { |
| 59 [description appendString:@", should launch in incognito"]; | 44 [description appendString:@", should launch in incognito"]; |
| 60 } | 45 } |
| 61 | 46 |
| 62 if (self.launchFocusOmnibox) { | 47 if (self.launchFocusOmnibox) { |
| 63 [description appendString:@", should focus omnibox"]; | 48 [description appendString:@", should focus omnibox"]; |
| 64 } | 49 } |
| 65 | 50 |
| 66 if (self.launchVoiceSearch) { | 51 if (self.launchVoiceSearch) { |
| 67 [description appendString:@", should launch voice search"]; | 52 [description appendString:@", should launch voice search"]; |
| 68 } | 53 } |
| 69 | 54 |
| 70 return description; | 55 return description; |
| 71 } | 56 } |
| 72 | 57 |
| 73 @end | 58 @end |
| OLD | NEW |