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_APP_LAUNCH_PARAMS_H_ | 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_APP_LAUNCH_PARAMS_H_ |
6 #define CHROME_BROWSER_UI_EXTENSIONS_APP_LAUNCH_PARAMS_H_ | 6 #define CHROME_BROWSER_UI_EXTENSIONS_APP_LAUNCH_PARAMS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "chrome/browser/ui/host_desktop.h" | |
13 #include "chrome/common/extensions/extension_constants.h" | 12 #include "chrome/common/extensions/extension_constants.h" |
14 #include "extensions/common/constants.h" | 13 #include "extensions/common/constants.h" |
15 #include "ui/base/window_open_disposition.h" | 14 #include "ui/base/window_open_disposition.h" |
16 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
17 #include "url/gurl.h" | 16 #include "url/gurl.h" |
18 | 17 |
19 class Profile; | 18 class Profile; |
20 | 19 |
21 namespace extensions { | 20 namespace extensions { |
22 class Extension; | 21 class Extension; |
23 } | 22 } |
24 | 23 |
25 struct AppLaunchParams { | 24 struct AppLaunchParams { |
26 AppLaunchParams(Profile* profile, | 25 AppLaunchParams(Profile* profile, |
27 const extensions::Extension* extension, | 26 const extensions::Extension* extension, |
28 extensions::LaunchContainer container, | 27 extensions::LaunchContainer container, |
29 WindowOpenDisposition disposition, | 28 WindowOpenDisposition disposition, |
30 extensions::AppLaunchSource source); | 29 extensions::AppLaunchSource source); |
31 | 30 |
32 // Helper to create AppLaunchParams using extensions::GetLaunchContainer with | |
33 // LAUNCH_TYPE_REGULAR to check for a user-configured container. | |
34 AppLaunchParams(Profile* profile, | |
35 const extensions::Extension* extension, | |
36 WindowOpenDisposition disposition, | |
37 extensions::AppLaunchSource source); | |
38 | |
39 // Helper to create AppLaunchParams using event flags that allows user to | |
40 // override the user-configured container using modifier keys, falling back to | |
41 // extensions::GetLaunchContainer() with no modifiers. |desktop_type| | |
42 // indicates the desktop upon which to launch (Ash or Native). | |
43 AppLaunchParams(Profile* profile, | |
44 const extensions::Extension* extension, | |
45 WindowOpenDisposition disposition, | |
46 chrome::HostDesktopType desktop_type, | |
47 extensions::AppLaunchSource source); | |
48 | |
49 AppLaunchParams(const AppLaunchParams& other); | 31 AppLaunchParams(const AppLaunchParams& other); |
50 | 32 |
51 ~AppLaunchParams(); | 33 ~AppLaunchParams(); |
52 | 34 |
53 // The profile to load the application from. | 35 // The profile to load the application from. |
54 Profile* profile; | 36 Profile* profile; |
55 | 37 |
56 // The extension to load. | 38 // The extension to load. |
57 std::string extension_id; | 39 std::string extension_id; |
58 | 40 |
59 // The container type to launch the application in. | 41 // The container type to launch the application in. |
60 extensions::LaunchContainer container; | 42 extensions::LaunchContainer container; |
61 | 43 |
62 // If container is TAB, this field controls how the tab is opened. | 44 // If container is TAB, this field controls how the tab is opened. |
63 WindowOpenDisposition disposition; | 45 WindowOpenDisposition disposition; |
64 | 46 |
65 // The desktop type to launch on. Uses GetActiveDesktop() if unspecified. | |
66 chrome::HostDesktopType desktop_type; | |
67 | |
68 // If non-empty, use override_url in place of the application's launch url. | 47 // If non-empty, use override_url in place of the application's launch url. |
69 GURL override_url; | 48 GURL override_url; |
70 | 49 |
71 // If non-empty, use override_boudns in place of the application's default | 50 // If non-empty, use override_boudns in place of the application's default |
72 // position and dimensions. | 51 // position and dimensions. |
73 gfx::Rect override_bounds; | 52 gfx::Rect override_bounds; |
74 | 53 |
75 // If non-empty, information from the command line may be passed on to the | 54 // If non-empty, information from the command line may be passed on to the |
76 // application. | 55 // application. |
77 base::CommandLine command_line; | 56 base::CommandLine command_line; |
78 | 57 |
79 // If non-empty, the current directory from which any relative paths on the | 58 // If non-empty, the current directory from which any relative paths on the |
80 // command line should be expanded from. | 59 // command line should be expanded from. |
81 base::FilePath current_directory; | 60 base::FilePath current_directory; |
82 | 61 |
83 // Record where the app is launched from for tracking purpose. | 62 // Record where the app is launched from for tracking purpose. |
84 // Different app may have their own enumeration of sources. | 63 // Different app may have their own enumeration of sources. |
85 extensions::AppLaunchSource source; | 64 extensions::AppLaunchSource source; |
86 }; | 65 }; |
87 | 66 |
| 67 // Helper to create AppLaunchParams using extensions::GetLaunchContainer with |
| 68 // LAUNCH_TYPE_REGULAR to check for a user-configured container. |
| 69 AppLaunchParams CreateAppLaunchParamsUserContainer( |
| 70 Profile* profile, |
| 71 const extensions::Extension* extension, |
| 72 WindowOpenDisposition disposition, |
| 73 extensions::AppLaunchSource source); |
| 74 |
| 75 // Helper to create AppLaunchParams using event flags that allows user to |
| 76 // override the user-configured container using modifier keys, falling back to |
| 77 // extensions::GetLaunchContainer() with no modifiers. |
| 78 AppLaunchParams CreateAppLaunchParamsWithEventFlags( |
| 79 Profile* profile, |
| 80 const extensions::Extension* extension, |
| 81 int event_flags, |
| 82 extensions::AppLaunchSource source); |
| 83 |
88 #endif // CHROME_BROWSER_UI_EXTENSIONS_APP_LAUNCH_PARAMS_H_ | 84 #endif // CHROME_BROWSER_UI_EXTENSIONS_APP_LAUNCH_PARAMS_H_ |
OLD | NEW |