| 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 "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 23 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 24 | 24 |
| 25 } // namespace launch_util | 25 } // namespace launch_util |
| 26 | 26 |
| 27 class Extension; | 27 class Extension; |
| 28 class ExtensionPrefs; | 28 class ExtensionPrefs; |
| 29 | 29 |
| 30 // Gets the launch type preference. If no preference is set, returns | 30 // Gets the launch type preference. If no preference is set, returns |
| 31 // LAUNCH_TYPE_DEFAULT. | 31 // LAUNCH_TYPE_DEFAULT. |
| 32 // Returns LAUNCH_TYPE_WINDOW if there's no preference and | 32 // Returns LAUNCH_TYPE_WINDOW if there's no preference and |
| 33 // 'streamlined hosted apps' are enabled. | 33 // bookmark apps are enabled. |
| 34 LaunchType GetLaunchType(const ExtensionPrefs* prefs, | 34 LaunchType GetLaunchType(const ExtensionPrefs* prefs, |
| 35 const Extension* extension); | 35 const Extension* extension); |
| 36 | 36 |
| 37 // Returns the LaunchType that is set in the prefs. Returns LAUNCH_TYPE_INVALID | 37 // Returns the LaunchType that is set in the prefs. Returns LAUNCH_TYPE_INVALID |
| 38 // if no value is set in prefs. | 38 // if no value is set in prefs. |
| 39 LaunchType GetLaunchTypePrefValue(const ExtensionPrefs* prefs, | 39 LaunchType GetLaunchTypePrefValue(const ExtensionPrefs* prefs, |
| 40 const std::string& extension_id); | 40 const std::string& extension_id); |
| 41 | 41 |
| 42 // Sets an extension's launch type preference and syncs the value if necessary. | 42 // Sets an extension's launch type preference and syncs the value if necessary. |
| 43 void SetLaunchType(content::BrowserContext* context, | 43 void SetLaunchType(content::BrowserContext* context, |
| 44 const std::string& extension_id, | 44 const std::string& extension_id, |
| 45 LaunchType launch_type); | 45 LaunchType launch_type); |
| 46 | 46 |
| 47 // Finds the right launch container based on the 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 | 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. | 49 // value from GetLaunchType() is used to choose the launch container. |
| 50 LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs, | 50 LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs, |
| 51 const Extension* extension); | 51 const Extension* extension); |
| 52 | 52 |
| 53 // Returns true if a launch container preference has been specified for | 53 // Returns true if a launch container preference has been specified for |
| 54 // |extension|. GetLaunchContainer() will still return a default value even if | 54 // |extension|. GetLaunchContainer() will still return a default value even if |
| 55 // this returns false. | 55 // this returns false. |
| 56 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs, | 56 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs, |
| 57 const Extension* extension); | 57 const Extension* extension); |
| 58 | 58 |
| 59 } // namespace extensions | 59 } // namespace extensions |
| 60 | 60 |
| 61 #endif // CHROME_BROWSER_EXTENSIONS_LAUNCH_UTIL_H_ | 61 #endif // CHROME_BROWSER_EXTENSIONS_LAUNCH_UTIL_H_ |
| OLD | NEW |