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