OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_ | 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_ |
6 #define CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_ | 6 #define CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_ |
7 | 7 |
8 #include "chrome/common/extensions/extension_constants.h" | 8 #include "chrome/common/extensions/extension_constants.h" |
9 #include "webkit/glue/window_open_disposition.h" | 9 #include "webkit/glue/window_open_disposition.h" |
10 | 10 |
11 class Browser; | 11 class Browser; |
12 class CommandLine; | 12 class CommandLine; |
13 class GURL; | 13 class GURL; |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class WebContents; | 17 class WebContents; |
18 } | 18 } |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 class Extension; | 21 class Extension; |
22 } | 22 } |
23 | 23 |
24 namespace application_launch { | 24 namespace application_launch { |
25 | 25 |
26 // Open |extension| in |container|, using |disposition| if container type is | 26 struct LaunchParams { |
27 // TAB. Returns the WebContents* that was created or NULL. If non-empty, | 27 LaunchParams(Profile* profile, |
28 // |override_url| is used in place of the app launch url. Pass relevant | 28 const extensions::Extension* extension, |
29 // information in |command_line| onto platform app as launch data. | 29 extension_misc::LaunchContainer container, |
30 // |command_line| can be NULL, indicating there is no launch data to pass on. | 30 WindowOpenDisposition disposition); |
31 // TODO(benwells): Put the parameters to this into an ApplicationLaunchParams | |
32 // struct. | |
33 content::WebContents* OpenApplication(Profile* profile, | |
34 const extensions::Extension* extension, | |
35 extension_misc::LaunchContainer container, | |
36 const GURL& override_url, | |
37 WindowOpenDisposition disposition, | |
38 const CommandLine* command_line); | |
39 | 31 |
40 // Opens a new application window for the specified url. If |as_panel| is true, | 32 // The profile to load the application from. |
41 // the application will be opened as a Browser::Type::APP_PANEL in app panel | 33 Profile* profile; |
42 // window, otherwise it will be opened as as either Browser::Type::APP a.k.a. | 34 |
43 // "thin frame" (if |extension| is NULL) or Browser::Type::EXTENSION_APP (if | 35 // The extension to load. |
44 // |extension| is non-NULL)./ If |app_browser| is not NULL, it is set to the | 36 const extensions::Extension* extension; |
45 // browser that hosts the returned tab. | 37 |
46 content::WebContents* OpenApplicationWindow( | 38 // The container type to launch the application in. |
47 Profile* profile, | 39 extension_misc::LaunchContainer container; |
48 const extensions::Extension* extension, | 40 |
49 extension_misc::LaunchContainer container, | 41 // If container is TAB, this field controls how the tab is opened. |
50 const GURL& url, | 42 WindowOpenDisposition disposition; |
51 Browser** app_browser); | 43 |
| 44 // If non-empty, use override_url in place of the application's launch url. |
| 45 GURL override_url; |
| 46 |
| 47 // If non-NULL, information from the command line may be passed on to the |
| 48 // application. |
| 49 const CommandLine* command_line; |
| 50 }; |
| 51 |
| 52 // Open the application in a way specified by |params|. |
| 53 content::WebContents* OpenApplication(const LaunchParams& params); |
52 | 54 |
53 // Open |url| in an app shortcut window. If |update_shortcut| is true, | 55 // Open |url| in an app shortcut window. If |update_shortcut| is true, |
54 // update the name, description, and favicon of the shortcut. | 56 // update the name, description, and favicon of the shortcut. |
55 // There are two kinds of app shortcuts: Shortcuts to a URL, | 57 // There are two kinds of app shortcuts: Shortcuts to a URL, |
56 // and shortcuts that open an installed application. This function | 58 // and shortcuts that open an installed application. This function |
57 // is used to open the former. To open the latter, use | 59 // is used to open the former. To open the latter, use |
58 // Browser::OpenApplicationWindow(). | 60 // application_launch::OpenApplication(). |
59 content::WebContents* OpenAppShortcutWindow(Profile* profile, | 61 content::WebContents* OpenAppShortcutWindow(Profile* profile, |
60 const GURL& url, | 62 const GURL& url); |
61 bool update_shortcut); | |
62 | |
63 // Open an application for |extension| using |disposition|. Returns NULL if | |
64 // there are no appropriate existing browser windows for |profile|. If | |
65 // non-empty, |override_url| is used in place of the app launch url. | |
66 content::WebContents* OpenApplicationTab(Profile* profile, | |
67 const extensions::Extension* extension, | |
68 const GURL& override_url, | |
69 WindowOpenDisposition disposition); | |
70 | 63 |
71 } // namespace application_launch | 64 } // namespace application_launch |
72 | 65 |
73 #endif // CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_ | 66 #endif // CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_ |
OLD | NEW |