OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_LAUNCH_UTIL_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_LAUNCH_UTIL_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "extensions/common/constants.h" |
| 11 |
| 12 namespace extensions { |
| 13 |
| 14 class Extension; |
| 15 class ExtensionPrefs; |
| 16 |
| 17 // This enum is used for the launch type the user wants to use for an |
| 18 // application. |
| 19 // Do not remove items or re-order this enum as it is used in preferences |
| 20 // and histograms. |
| 21 enum LaunchType { |
| 22 LAUNCH_TYPE_PINNED, |
| 23 LAUNCH_TYPE_REGULAR, |
| 24 LAUNCH_TYPE_FULLSCREEN, |
| 25 LAUNCH_TYPE_WINDOW, |
| 26 |
| 27 // Launch an app in the in the way a click on the NTP would, |
| 28 // if no user pref were set. Update this constant to change |
| 29 // the default for the NTP and chrome.management.launchApp(). |
| 30 LAUNCH_TYPE_DEFAULT = LAUNCH_TYPE_REGULAR |
| 31 }; |
| 32 |
| 33 // Gets the launch type preference. If no preference is set, returns |
| 34 // LAUNCH_DEFAULT. |
| 35 // Returns LAUNCH_WINDOW if there's no preference and |
| 36 // 'streamlined hosted apps' are enabled. |
| 37 LaunchType GetLaunchType(const ExtensionPrefs* prefs, |
| 38 const Extension* extension); |
| 39 |
| 40 // Sets an extension's launch type preference. |
| 41 void SetLaunchType(ExtensionPrefs* prefs, |
| 42 const std::string& extension_id, |
| 43 LaunchType launch_type); |
| 44 |
| 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); |
| 50 |
| 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); |
| 56 |
| 57 } // namespace extensions |
| 58 |
| 59 #endif // CHROME_BROWSER_EXTENSIONS_LAUNCH_UTIL_H_ |
OLD | NEW |