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