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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_
6 #define CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_
8 #include "base/command_line.h"
9 #include "base/files/file_path.h"
10 #include "chrome/browser/ui/host_desktop.h"
11 #include "chrome/common/extensions/extension_constants.h"
12 #include "ui/base/window_open_disposition.h"
13 #include "ui/gfx/rect.h"
24 namespace extensions
{
28 struct AppLaunchParams
{
29 AppLaunchParams(Profile
* profile
,
30 const extensions::Extension
* extension
,
31 extensions::LaunchContainer container
,
32 WindowOpenDisposition disposition
);
34 // Helper to create AppLaunchParams using extensions::GetLaunchContainer with
35 // LAUNCH_TYPE_REGULAR to check for a user-configured container.
36 AppLaunchParams(Profile
* profile
,
37 const extensions::Extension
* extension
,
38 WindowOpenDisposition disposition
);
40 // Helper to create AppLaunchParams using event flags that allows user to
41 // override the user-configured container using modifier keys, falling back to
42 // extensions::GetLaunchContainer() with no modifiers. |desktop_type|
43 // indicates the desktop upon which to launch (Ash or Native).
44 AppLaunchParams(Profile
* profile
,
45 const extensions::Extension
* extension
,
47 chrome::HostDesktopType desktop_type
);
51 // The profile to load the application from.
54 // The extension to load.
55 std::string extension_id
;
57 // The container type to launch the application in.
58 extensions::LaunchContainer container
;
60 // If container is TAB, this field controls how the tab is opened.
61 WindowOpenDisposition disposition
;
63 // The desktop type to launch on. Uses GetActiveDesktop() if unspecified.
64 chrome::HostDesktopType desktop_type
;
66 // If non-empty, use override_url in place of the application's launch url.
69 // If non-empty, use override_boudns in place of the application's default
70 // position and dimensions.
71 gfx::Rect override_bounds
;
73 // If non-empty, information from the command line may be passed on to the
75 CommandLine command_line
;
77 // If non-empty, the current directory from which any relative paths on the
78 // command line should be expanded from.
79 base::FilePath current_directory
;
82 // Opens the application, possibly prompting the user to re-enable it.
83 void OpenApplicationWithReenablePrompt(const AppLaunchParams
& params
);
85 // Open the application in a way specified by |params|.
86 content::WebContents
* OpenApplication(const AppLaunchParams
& params
);
88 // Open |url| in an app shortcut window. |override_bounds| param is optional.
89 // There are two kinds of app shortcuts: Shortcuts to a URL,
90 // and shortcuts that open an installed application. This function
91 // is used to open the former. To open the latter, use
92 // application_launch::OpenApplication().
93 content::WebContents
* OpenAppShortcutWindow(Profile
* profile
,
95 const gfx::Rect
& override_bounds
);
97 #endif // CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_