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/ui/commands/open_url_command.h"
7 #include "base/logging.h"
8 #include "base/mac/scoped_nsobject.h"
9 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
10 #include "ios/web/public/referrer.h"
13 @implementation OpenUrlCommand {
15 web::Referrer _referrer;
16 base::scoped_nsobject<NSString> _windowName;
19 @synthesize inIncognito = _inIncognito;
20 @synthesize inBackground = _inBackground;
21 @synthesize fromChrome = _fromChrome;
22 @synthesize appendTo = _appendTo;
24 - (instancetype)initWithTag:(NSInteger)tag {
29 - (instancetype)initWithURL:(const GURL&)url
30 referrer:(const web::Referrer&)referrer
31 windowName:(NSString*)windowName
32 inIncognito:(BOOL)inIncognito
33 inBackground:(BOOL)inBackground
34 appendTo:(OpenPosition)appendTo {
35 if ((self = [super initWithTag:IDC_OPEN_URL])) {
38 _windowName.reset([windowName copy]);
39 _inIncognito = inIncognito;
40 _inBackground = inBackground;
46 - (instancetype)initWithURLFromChrome:(const GURL&)url {
47 if ((self = [self initWithURL:url
48 referrer:web::Referrer()
52 appendTo:kLastTab])) {
62 - (const web::Referrer&)referrer {
66 - (NSString*)windowName {
67 return _windowName.get();