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