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