application_launch.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
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.
4
5#ifndef CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_
6#define CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_
7
8#include "base/file_path.h"
9#include "chrome/common/extensions/extension_constants.h"
10#include "googleurl/src/gurl.h"
11#include "webkit/glue/window_open_disposition.h"
12
13class Browser;
14class CommandLine;
15class Profile;
16
17namespace content {
18class WebContents;
19}
20
21namespace extensions {
22class Extension;
23}
24
25namespace gfx {
26class Rect;
27}
28
29namespace application_launch {
30
31struct LaunchParams {
32  LaunchParams(Profile* profile,
33               const extensions::Extension* extension,
34               extension_misc::LaunchContainer container,
35               WindowOpenDisposition disposition);
36
37  // The profile to load the application from.
38  Profile* profile;
39
40  // The extension to load.
41  const extensions::Extension* extension;
42
43  // The container type to launch the application in.
44  extension_misc::LaunchContainer container;
45
46  // If container is TAB, this field controls how the tab is opened.
47  WindowOpenDisposition disposition;
48
49  // If non-empty, use override_url in place of the application's launch url.
50  GURL override_url;
51
52  // If non-NULL, information from the command line may be passed on to the
53  // application.
54  const CommandLine* command_line;
55
56  // If non-empty, the current directory from which any relative paths on the
57  // command line should be expanded from.
58  FilePath current_directory;
59};
60
61// Open the application in a way specified by |params|.
62content::WebContents* OpenApplication(const LaunchParams& params);
63
64// Open |url| in an app shortcut window. |override_bounds| param is optional.
65// There are two kinds of app shortcuts: Shortcuts to a URL,
66// and shortcuts that open an installed application.  This function
67// is used to open the former.  To open the latter, use
68// application_launch::OpenApplication().
69content::WebContents* OpenAppShortcutWindow(Profile* profile,
70                                            const GURL& url,
71                                            const gfx::Rect& override_bounds);
72
73}  // namespace application_launch
74
75#endif  // CHROME_BROWSER_UI_EXTENSIONS_APPLICATION_LAUNCH_H_
76