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 user_prefs
{
15 class PrefRegistrySyncable
;
18 namespace extensions
{
19 namespace launch_util
{
21 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable
* registry
);
23 } // namespace launch_util
28 // Gets the launch type preference. If no preference is set, returns
29 // LAUNCH_TYPE_DEFAULT.
30 // Returns LAUNCH_TYPE_WINDOW if there's no preference and
31 // 'streamlined hosted apps' are enabled.
32 LaunchType
GetLaunchType(const ExtensionPrefs
* prefs
,
33 const Extension
* extension
);
35 // Returns the LaunchType that is set in the prefs. Returns LAUNCH_TYPE_INVALID
36 // if no value is set in prefs.
37 LaunchType
GetLaunchTypePrefValue(const ExtensionPrefs
* prefs
,
38 const std::string
& extension_id
);
40 // Sets an extension's launch type preference and syncs the value if necessary.
41 void SetLaunchType(ExtensionService
* prefs
,
42 const std::string
& extension_id
,
43 LaunchType launch_type
);
45 // Finds the right launch container based on the launch type.
46 // If |extension|'s prefs do not have a launch type set, then the default
47 // value from GetLaunchType() is used to choose the launch container.
48 LaunchContainer
GetLaunchContainer(const ExtensionPrefs
* prefs
,
49 const Extension
* extension
);
51 // Returns true if a launch container preference has been specified for
52 // |extension|. GetLaunchContainer() will still return a default value even if
53 // this returns false.
54 bool HasPreferredLaunchContainer(const ExtensionPrefs
* prefs
,
55 const Extension
* extension
);
57 } // namespace extensions
59 #endif // CHROME_BROWSER_EXTENSIONS_LAUNCH_UTIL_H_