Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / ios / chrome / browser / ui / commands / open_url_command.mm
blob5322cd5d3bc54b51374d9ce1380a18b186a6c597
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"
11 #include "url/gurl.h"
13 @implementation OpenUrlCommand {
14   GURL _url;
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 {
25   NOTREACHED();
26   return nil;
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])) {
36     _url = url;
37     _referrer = referrer;
38     _windowName.reset([windowName copy]);
39     _inIncognito = inIncognito;
40     _inBackground = inBackground;
41     _appendTo = appendTo;
42   }
43   return self;
46 - (instancetype)initWithURLFromChrome:(const GURL&)url {
47   if ((self = [self initWithURL:url
48                        referrer:web::Referrer()
49                      windowName:nil
50                     inIncognito:NO
51                    inBackground:NO
52                        appendTo:kLastTab])) {
53     _fromChrome = YES;
54   }
55   return self;
58 - (const GURL&)url {
59   return _url;
62 - (const web::Referrer&)referrer {
63   return _referrer;
66 - (NSString*)windowName {
67   return _windowName.get();
70 @end