1 // Copyright (c) 2013 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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_LAUNCH_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_LAUNCH_UTIL_H_
10 #include "chrome/common/extensions/extension_constants.h"
12 class ExtensionService
;
14 namespace extensions
{
19 // Gets the launch type preference. If no preference is set, returns
20 // LAUNCH_TYPE_DEFAULT.
21 // Returns LAUNCH_TYPE_WINDOW if there's no preference and
22 // 'streamlined hosted apps' are enabled.
23 LaunchType
GetLaunchType(const ExtensionPrefs
* prefs
,
24 const Extension
* extension
);
26 // Returns the LaunchType that is set in the prefs. Returns LAUNCH_TYPE_INVALID
27 // if no value is set in prefs.
28 LaunchType
GetLaunchTypePrefValue(const ExtensionPrefs
* prefs
,
29 const std::string
& extension_id
);
31 // Sets an extension's launch type preference and syncs the value if necessary.
32 void SetLaunchType(ExtensionService
* prefs
,
33 const std::string
& extension_id
,
34 LaunchType launch_type
);
36 // Finds the right launch container based on the launch type.
37 // If |extension|'s prefs do not have a launch type set, then the default
38 // value from GetLaunchType() is used to choose the launch container.
39 LaunchContainer
GetLaunchContainer(const ExtensionPrefs
* prefs
,
40 const Extension
* extension
);
42 // Returns true if a launch container preference has been specified for
43 // |extension|. GetLaunchContainer() will still return a default value even if
44 // this returns false.
45 bool HasPreferredLaunchContainer(const ExtensionPrefs
* prefs
,
46 const Extension
* extension
);
48 } // namespace extensions
50 #endif // CHROME_BROWSER_EXTENSIONS_LAUNCH_UTIL_H_