• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 #include "chrome/browser/extensions/extension_management_constants.h"
6 
7 #include "base/macros.h"
8 
9 namespace extensions {
10 namespace schema_constants {
11 
12 const char kWildcard[] = "*";
13 
14 const char kInstallationMode[] = "installation_mode";
15 const char kAllowed[] = "allowed";
16 const char kBlocked[] = "blocked";
17 const char kForceInstalled[] = "force_installed";
18 const char kNormalInstalled[] = "normal_installed";
19 
20 const char kUpdateUrl[] = "update_url";
21 const char kInstallSources[] = "install_sources";
22 const char kAllowedTypes[] = "allowed_types";
23 
24 const char kUpdateUrlPrefix[] = "update_url:";
25 
26 const AllowedTypesMapEntry kAllowedTypesMap[] = {
27   { "extension",           Manifest::TYPE_EXTENSION },
28   { "theme",               Manifest::TYPE_THEME },
29   { "user_script",         Manifest::TYPE_USER_SCRIPT },
30   { "hosted_app",          Manifest::TYPE_HOSTED_APP },
31   { "legacy_packaged_app", Manifest::TYPE_LEGACY_PACKAGED_APP },
32   { "platform_app",        Manifest::TYPE_PLATFORM_APP },
33   // TODO(binjin): Add shared_module type here and update ExtensionAllowedTypes
34   // policy.
35 };
36 
37 const size_t kAllowedTypesMapSize = arraysize(kAllowedTypesMap);
38 
GetManifestType(const std::string & name)39 Manifest::Type GetManifestType(const std::string& name) {
40   for (size_t index = 0; index < kAllowedTypesMapSize; ++index) {
41     if (kAllowedTypesMap[index].name == name)
42       return kAllowedTypesMap[index].manifest_type;
43   }
44   return Manifest::TYPE_UNKNOWN;
45 }
46 
47 }  // namespace schema_constants
48 }  // namespace extensions
49