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. |
| 23 - (instancetype)initWithTag:(NSInteger)tag NS_UNAVAILABLE; |
| 24 |
| 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; |
| 32 |
| 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 |
| 35 // mode. |
| 36 - (instancetype)initWithURLFromChrome:(const GURL&)url; |
| 37 |
| 38 // URL to open. |
| 39 @property(nonatomic, readonly) const GURL& url; |
| 40 |
| 41 // Referrer for the URL. |
| 42 @property(nonatomic, readonly) const web::Referrer& referrer; |
| 43 |
| 44 // Name of the window. |
| 45 @property(nonatomic, readonly) NSString* windowName; |
| 46 |
| 47 // Whether this URL command requests opening in incognito or not. |
| 48 @property(nonatomic, readonly) BOOL inIncognito; |
| 49 |
| 50 // Whether this URL command requests opening in background or not. |
| 51 @property(nonatomic, readonly) BOOL inBackground; |
| 52 |
22 // Whether or not this URL command comes from a chrome context (e.g., settings), | 53 // Whether or not this URL command comes from a chrome context (e.g., settings), |
23 // as opposed to a web page context. | 54 // as opposed to a web page context. |
24 @property(nonatomic, readonly) BOOL fromChrome; | 55 @property(nonatomic, readonly) BOOL fromChrome; |
25 | 56 |
26 // Initializes a command intended to open a URL as a link from a page. | 57 // Location where the new tab should be opened. |
27 // Designated initializer. | 58 @property(nonatomic, readonly) OpenPosition appendTo; |
28 - (id)initWithURL:(const GURL&)url | |
29 referrer:(const web::Referrer&)referrer | |
30 windowName:(NSString*)windowName | |
31 inIncognito:(BOOL)inIncognito | |
32 inBackground:(BOOL)inBackground | |
33 appendTo:(OpenPosition)append; | |
34 | |
35 // Initializes a command intended to open a URL from browser chrome (e.g., | |
36 // settings). This will always open in a new foreground tab in non-incognito | |
37 // mode. | |
38 - (id)initWithURLFromChrome:(const GURL&)url; | |
39 | |
40 - (const GURL&)url; | |
41 - (const web::Referrer&)referrer; | |
42 - (NSString*)windowName; | |
43 - (BOOL)inIncognito; | |
44 - (BOOL)inBackground; | |
45 - (OpenPosition)appendTo; | |
46 | 59 |
47 @end | 60 @end |
48 | 61 |
49 #endif // IOS_CHROME_BROWSER_UI_COMMANDS_OPEN_URL_COMMAND_H_ | 62 #endif // IOS_CHROME_BROWSER_UI_COMMANDS_OPEN_URL_COMMAND_H_ |
OLD | NEW |