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 #ifndef IOS_CHROME_BROWSER_UI_COMMANDS_OPEN_URL_COMMAND_H_
6 #define IOS_CHROME_BROWSER_UI_COMMANDS_OPEN_URL_COMMAND_H_
8 #import <UIKit/UIKit.h>
10 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
11 #import "ios/chrome/browser/ui/url_loader.h"
19 // A command to open a new tab.
20 @interface OpenUrlCommand
: GenericChromeCommand
22 // Mark inherited initializer as unavailable to prevent calling it by mistake.
23 - (instancetype
)initWithTag
:(NSInteger
)tag NS_UNAVAILABLE
;
25 // Initializes a command intended to open a URL as a link from a page.
26 - (instancetype
)initWithURL
:(const GURL
&)url
27 referrer
:(const web::Referrer
&)referrer
28 windowName
:(NSString
*)windowName
29 inIncognito
:(BOOL
)inIncognito
30 inBackground
:(BOOL
)inBackground
31 appendTo
:(OpenPosition
)append NS_DESIGNATED_INITIALIZER
;
33 // Initializes a command intended to open a URL from browser chrome (e.g.,
34 // settings). This will always open in a new foreground tab in non-incognito
36 - (instancetype
)initWithURLFromChrome
:(const GURL
&)url
;
39 @
property(nonatomic
, readonly
) const GURL
& url
;
41 // Referrer for the URL.
42 @
property(nonatomic
, readonly
) const web::Referrer
& referrer
;
44 // Name of the window.
45 @
property(nonatomic
, readonly
) NSString
* windowName
;
47 // Whether this URL command requests opening in incognito or not.
48 @
property(nonatomic
, readonly
) BOOL inIncognito
;
50 // Whether this URL command requests opening in background or not.
51 @
property(nonatomic
, readonly
) BOOL inBackground
;
53 // Whether or not this URL command comes from a chrome context (e.g., settings),
54 // as opposed to a web page context.
55 @
property(nonatomic
, readonly
) BOOL fromChrome
;
57 // Location where the new tab should be opened.
58 @
property(nonatomic
, readonly
) OpenPosition appendTo
;
62 #endif // IOS_CHROME_BROWSER_UI_COMMANDS_OPEN_URL_COMMAND_H_