Home | History | Annotate | Download | only in extensions
      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 "chrome/common/extensions/extension_constants.h"
     11 
     12 class ExtensionService;
     13 
     14 namespace user_prefs {
     15 class PrefRegistrySyncable;
     16 }
     17 
     18 namespace extensions {
     19 namespace launch_util {
     20 
     21 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
     22 
     23 }  // namespace launch_util
     24 
     25 class Extension;
     26 class ExtensionPrefs;
     27 
     28 // Gets the launch type preference. If no preference is set, returns
     29 // LAUNCH_TYPE_DEFAULT.
     30 // Returns LAUNCH_TYPE_WINDOW if there's no preference and
     31 // 'streamlined hosted apps' are enabled.
     32 LaunchType GetLaunchType(const ExtensionPrefs* prefs,
     33                          const Extension* extension);
     34 
     35 // Returns the LaunchType that is set in the prefs. Returns LAUNCH_TYPE_INVALID
     36 // if no value is set in prefs.
     37 LaunchType GetLaunchTypePrefValue(const ExtensionPrefs* prefs,
     38                                   const std::string& extension_id);
     39 
     40 // Sets an extension's launch type preference and syncs the value if necessary.
     41 void SetLaunchType(ExtensionService* 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_
     60