OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/ui/extensions/app_launch_params.h" | 5 #include "chrome/browser/ui/extensions/app_launch_params.h" |
6 | 6 |
7 #include "chrome/browser/extensions/launch_util.h" | 7 #include "chrome/browser/extensions/launch_util.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "extensions/browser/extension_prefs.h" | 9 #include "extensions/browser/extension_prefs.h" |
| 10 #include "extensions/common/constants.h" |
10 #include "extensions/common/extension.h" | 11 #include "extensions/common/extension.h" |
11 | 12 |
12 using extensions::ExtensionPrefs; | 13 using extensions::ExtensionPrefs; |
13 | 14 |
14 AppLaunchParams::AppLaunchParams(Profile* profile, | 15 AppLaunchParams::AppLaunchParams(Profile* profile, |
15 const extensions::Extension* extension, | 16 const extensions::Extension* extension, |
16 extensions::LaunchContainer container, | 17 extensions::LaunchContainer container, |
17 WindowOpenDisposition disposition) | 18 WindowOpenDisposition disposition, |
| 19 extensions::AppLaunchSource source) |
18 : profile(profile), | 20 : profile(profile), |
19 extension_id(extension ? extension->id() : std::string()), | 21 extension_id(extension ? extension->id() : std::string()), |
20 container(container), | 22 container(container), |
21 disposition(disposition), | 23 disposition(disposition), |
22 desktop_type(chrome::GetActiveDesktop()), | 24 desktop_type(chrome::GetActiveDesktop()), |
23 override_url(), | 25 override_url(), |
24 override_bounds(), | 26 override_bounds(), |
25 command_line(CommandLine::NO_PROGRAM), | 27 command_line(CommandLine::NO_PROGRAM), |
26 source(extensions::SOURCE_UNTRACKED) { | 28 source(source) { |
27 } | 29 } |
28 | 30 |
29 AppLaunchParams::AppLaunchParams(Profile* profile, | 31 AppLaunchParams::AppLaunchParams(Profile* profile, |
30 const extensions::Extension* extension, | 32 const extensions::Extension* extension, |
31 WindowOpenDisposition disposition) | 33 WindowOpenDisposition disposition, |
| 34 extensions::AppLaunchSource source) |
32 : profile(profile), | 35 : profile(profile), |
33 extension_id(extension ? extension->id() : std::string()), | 36 extension_id(extension ? extension->id() : std::string()), |
34 container(extensions::LAUNCH_CONTAINER_NONE), | 37 container(extensions::LAUNCH_CONTAINER_NONE), |
35 disposition(disposition), | 38 disposition(disposition), |
36 desktop_type(chrome::GetActiveDesktop()), | 39 desktop_type(chrome::GetActiveDesktop()), |
37 override_url(), | 40 override_url(), |
38 override_bounds(), | 41 override_bounds(), |
39 command_line(CommandLine::NO_PROGRAM), | 42 command_line(CommandLine::NO_PROGRAM), |
40 source(extensions::SOURCE_UNTRACKED) { | 43 source(source) { |
41 // Look up the app preference to find out the right launch container. Default | 44 // Look up the app preference to find out the right launch container. Default |
42 // is to launch as a regular tab. | 45 // is to launch as a regular tab. |
43 container = | 46 container = |
44 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); | 47 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); |
45 } | 48 } |
46 | 49 |
47 AppLaunchParams::AppLaunchParams(Profile* profile, | 50 AppLaunchParams::AppLaunchParams(Profile* profile, |
48 const extensions::Extension* extension, | 51 const extensions::Extension* extension, |
49 int event_flags, | 52 int event_flags, |
50 chrome::HostDesktopType desktop_type) | 53 chrome::HostDesktopType desktop_type, |
| 54 extensions::AppLaunchSource source) |
51 : profile(profile), | 55 : profile(profile), |
52 extension_id(extension ? extension->id() : std::string()), | 56 extension_id(extension ? extension->id() : std::string()), |
53 container(extensions::LAUNCH_CONTAINER_NONE), | 57 container(extensions::LAUNCH_CONTAINER_NONE), |
54 disposition(ui::DispositionFromEventFlags(event_flags)), | 58 disposition(ui::DispositionFromEventFlags(event_flags)), |
55 desktop_type(desktop_type), | 59 desktop_type(desktop_type), |
56 override_url(), | 60 override_url(), |
57 override_bounds(), | 61 override_bounds(), |
58 command_line(CommandLine::NO_PROGRAM), | 62 command_line(CommandLine::NO_PROGRAM), |
59 source(extensions::SOURCE_UNTRACKED) { | 63 source(source) { |
60 if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) { | 64 if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) { |
61 container = extensions::LAUNCH_CONTAINER_TAB; | 65 container = extensions::LAUNCH_CONTAINER_TAB; |
62 } else if (disposition == NEW_WINDOW) { | 66 } else if (disposition == NEW_WINDOW) { |
63 container = extensions::LAUNCH_CONTAINER_WINDOW; | 67 container = extensions::LAUNCH_CONTAINER_WINDOW; |
64 } else { | 68 } else { |
65 // Look at preference to find the right launch container. If no preference | 69 // Look at preference to find the right launch container. If no preference |
66 // is set, launch as a regular tab. | 70 // is set, launch as a regular tab. |
67 container = | 71 container = |
68 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); | 72 extensions::GetLaunchContainer(ExtensionPrefs::Get(profile), extension); |
69 disposition = NEW_FOREGROUND_TAB; | 73 disposition = NEW_FOREGROUND_TAB; |
70 } | 74 } |
71 } | 75 } |
72 | 76 |
73 AppLaunchParams::~AppLaunchParams() { | 77 AppLaunchParams::~AppLaunchParams() { |
74 } | 78 } |
OLD | NEW |