| 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 // Sets an extension's launch type preference. |
| 25 void SetLaunchType(ExtensionPrefs* prefs, | 27 void SetLaunchType(ExtensionService* prefs, |
| 26 const std::string& extension_id, | 28 const std::string& extension_id, |
| 27 LaunchType launch_type); | 29 LaunchType launch_type); |
| 28 | 30 |
| 31 bool HasPreferredLaunchType(const ExtensionPrefs* prefs, |
| 32 const Extension* extension); |
| 33 |
| 29 // Finds the right launch container based on the launch type. | 34 // 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 | 35 // 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. | 36 // value from GetLaunchType() is used to choose the launch container. |
| 32 LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs, | 37 LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs, |
| 33 const Extension* extension); | 38 const Extension* extension); |
| 34 | 39 |
| 35 // Returns true if a launch container preference has been specified for | 40 // Returns true if a launch container preference has been specified for |
| 36 // |extension|. GetLaunchContainer() will still return a default value even if | 41 // |extension|. GetLaunchContainer() will still return a default value even if |
| 37 // this returns false. | 42 // this returns false. |
| 38 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs, | 43 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs, |
| 39 const Extension* extension); | 44 const Extension* extension); |
| 40 | 45 |
| 41 } // namespace extensions | 46 } // namespace extensions |
| 42 | 47 |
| 43 #endif // CHROME_BROWSER_EXTENSIONS_LAUNCH_UTIL_H_ | 48 #endif // CHROME_BROWSER_EXTENSIONS_LAUNCH_UTIL_H_ |
| OLD | NEW |