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
3 // found in the LICENSE file.
5 #import "ios/chrome/browser/app_startup_parameters.h"
7 #include "base/logging.h"
8 #import "base/mac/scoped_nsobject.h"
9 #import "ios/chrome/browser/xcallback_parameters.h"
12 @implementation AppStartupParameters {
14 base::scoped_nsobject<XCallbackParameters> _xCallbackParameters;
15 BOOL _launchVoiceSearch;
18 @synthesize launchVoiceSearch = _launchVoiceSearch;
20 - (const GURL&)externalURL {
24 - (XCallbackParameters*)xCallbackParameters {
25 return _xCallbackParameters.get();
28 - (instancetype)init {
31 [self initWithExternalURL:GURL() xCallbackParameters:nil voiceSearch:NO];
34 - (instancetype)initWithExternalURL:(const GURL&)externalURL {
35 return [self initWithExternalURL:externalURL
36 xCallbackParameters:nil
40 - (instancetype)initWithExternalURL:(const GURL&)externalURL
41 xCallbackParameters:(XCallbackParameters*)xCallbackParameters {
42 return [self initWithExternalURL:externalURL
43 xCallbackParameters:xCallbackParameters
47 - (instancetype)initWithExternalURL:(const GURL&)externalURL
48 xCallbackParameters:(XCallbackParameters*)xCallbackParameters
49 voiceSearch:(BOOL)voicesearch {
52 _externalURL = GURL(externalURL);
53 _xCallbackParameters.reset([xCallbackParameters retain]);
54 _launchVoiceSearch = voicesearch;
59 - (NSString*)description {
60 return [NSString stringWithFormat:@"ExternalURL: %s \nXCallbackParams: %@",
61 _externalURL.spec().c_str(),
62 _xCallbackParameters.get()];