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