Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/common/extensions/extension_constants.h" | 9 #include "chrome/common/extensions/extension_constants.h" |
| 10 #include "webkit/glue/window_open_disposition.h" | 10 #include "webkit/glue/window_open_disposition.h" |
| 11 | 11 |
| 12 class Browser; | 12 class Browser; |
| 13 class CommandLine; | 13 class CommandLine; |
| 14 class GURL; | 14 class GURL; |
| 15 class Profile; | 15 class Profile; |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 class WebContents; | 18 class WebContents; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace extensions { | 21 namespace extensions { |
| 22 class Extension; | 22 class Extension; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace application_launch { | 25 namespace application_launch { |
| 26 | 26 |
| 27 // Open |extension| in |container|, using |disposition| if container type is | 27 struct LaunchParams { |
| 28 // TAB. Returns the WebContents* that was created or NULL. If non-empty, | 28 LaunchParams(Profile* profile, |
| 29 // |override_url| is used in place of the app launch url. Pass relevant | 29 const extensions::Extension* extension, |
| 30 // information in |command_line| onto platform app as launch data. | 30 extension_misc::LaunchContainer container, |
| 31 // |command_line| can be NULL, indicating there is no launch data to pass on. | 31 WindowOpenDisposition disposition); |
| 32 // TODO(benwells): Put the parameters to this into an ApplicationLaunchParams | 32 |
| 33 // struct. | 33 // The profile to load the application from. |
| 34 content::WebContents* OpenApplication(Profile* profile, | 34 Profile* profile; |
| 35 const extensions::Extension* extension, | 35 |
| 36 extension_misc::LaunchContainer container, | 36 // The extension to load. |
| 37 const GURL& override_url, | 37 const extensions::Extension* extension; |
| 38 WindowOpenDisposition disposition, | 38 |
| 39 const CommandLine* command_line); | 39 // The container type to launch the application in. |
| 40 extension_misc::LaunchContainer container; | |
| 41 | |
| 42 // If container is TAB, this field controls how the tab is opened. | |
| 43 WindowOpenDisposition disposition; | |
| 44 | |
| 45 // If non-empty, use override_url in place of the application's launch url. | |
| 46 GURL override_url; | |
| 47 | |
| 48 // If non-NULL, information from the command line may be passed on to the | |
| 49 // application. | |
| 50 const CommandLine* command_line; | |
| 51 }; | |
| 52 | |
| 53 // Open the application in a way specified by |params|. | |
| 54 content::WebContents* OpenApplication(const LaunchParams& params); | |
| 40 | 55 |
| 41 // Opens |url| in a new application panel window for the specified url. | 56 // Opens |url| in a new application panel window for the specified url. |
| 42 content::WebContents* OpenApplicationPanel( | 57 content::WebContents* OpenApplicationPanel( |
|
Mihai Parparita -not on Chrome
2012/07/11 00:38:36
Can these other methods be removed from the header
Dmitry Titov
2012/07/11 01:03:24
This method is removed in https://chromiumcoderevi
benwells
2012/07/12 04:21:02
Yes indeed, I was thinking the same thing but forg
| |
| 43 Profile* profile, | 58 Profile* profile, |
| 44 const extensions::Extension* extension, | 59 const extensions::Extension* extension, |
| 45 const GURL& url); | 60 const GURL& url); |
| 46 | 61 |
| 47 // Opens a new application window for the specified url. If |as_panel| is true, | 62 // Opens a new application window for the specified url. If |as_panel| is true, |
|
Mihai Parparita -not on Chrome
2012/07/11 00:38:36
as_panel seems to no longer exist.
| |
| 48 // the application will be opened as a Browser::Type::APP_PANEL in app panel | 63 // the application will be opened as a Browser::Type::APP_PANEL in app panel |
| 49 // window, otherwise it will be opened as as either Browser::Type::APP a.k.a. | 64 // window, otherwise it will be opened as as either Browser::Type::APP a.k.a. |
| 50 // "thin frame" (if |extension| is NULL) or Browser::Type::EXTENSION_APP (if | 65 // "thin frame" (if |extension| is NULL) or Browser::Type::EXTENSION_APP (if |
| 51 // |extension| is non-NULL)./ If |app_browser| is not NULL, it is set to the | 66 // |extension| is non-NULL)./ If |app_browser| is not NULL, it is set to the |
| 52 // browser that hosts the returned tab. | 67 // browser that hosts the returned tab. |
| 53 content::WebContents* OpenApplicationWindow( | 68 content::WebContents* OpenApplicationWindow( |
| 54 Profile* profile, | 69 Profile* profile, |
| 55 const extensions::Extension* extension, | 70 const extensions::Extension* extension, |
| 56 extension_misc::LaunchContainer container, | 71 extension_misc::LaunchContainer container, |
| 57 const GURL& url, | 72 const GURL& url, |
| 58 Browser** app_browser); | 73 Browser** app_browser); |
| 59 | 74 |
| 60 // Open |url| in an app shortcut window. If |update_shortcut| is true, | 75 // Open |url| in an app shortcut window. If |update_shortcut| is true, |
| 61 // update the name, description, and favicon of the shortcut. | 76 // update the name, description, and favicon of the shortcut. |
| 62 // There are two kinds of app shortcuts: Shortcuts to a URL, | 77 // There are two kinds of app shortcuts: Shortcuts to a URL, |
| 63 // and shortcuts that open an installed application. This function | 78 // and shortcuts that open an installed application. This function |
| 64 // is used to open the former. To open the latter, use | 79 // is used to open the former. To open the latter, use |
| 65 // Browser::OpenApplicationWindow(). | 80 // Browser::OpenApplicationWindow(). |
|
Mihai Parparita -not on Chrome
2012/07/11 00:38:36
OpenApplicationWindow is no longer in Browser.
benwells
2012/07/12 04:21:02
Done.
| |
| 66 content::WebContents* OpenAppShortcutWindow(Profile* profile, | 81 content::WebContents* OpenAppShortcutWindow(Profile* profile, |
| 67 const GURL& url, | 82 const GURL& url, |
| 68 bool update_shortcut); | 83 bool update_shortcut); |
| 69 | 84 |
| 70 // Open an application for |extension| using |disposition|. Returns NULL if | 85 // Open an application for |extension| using |disposition|. Returns NULL if |
| 71 // there are no appropriate existing browser windows for |profile|. If | 86 // there are no appropriate existing browser windows for |profile|. If |
| 72 // non-empty, |override_url| is used in place of the app launch url. | 87 // non-empty, |override_url| is used in place of the app launch url. |
| 73 content::WebContents* OpenApplicationTab(Profile* profile, | 88 content::WebContents* OpenApplicationTab(Profile* profile, |
| 74 const extensions::Extension* extension, | 89 const extensions::Extension* extension, |
| 75 const GURL& override_url, | 90 const GURL& override_url, |
| 76 WindowOpenDisposition disposition); | 91 WindowOpenDisposition disposition); |
| 77 | 92 |
| 78 } // namespace application_launch | 93 } // namespace application_launch |
| 79 | 94 |
| 80 #endif // CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_ | 95 #endif // CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_ |
| OLD | NEW |