• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 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 EXTENSIONS_COMMON_CONSTANTS_H_
6 #define EXTENSIONS_COMMON_CONSTANTS_H_
7 
8 #include "base/basictypes.h"
9 #include "base/files/file_path.h"
10 #include "ui/base/layout.h"
11 
12 namespace extensions {
13 
14 // Scheme we serve extension content from.
15 extern const char kExtensionScheme[];
16 
17 // Canonical schemes you can use as input to GURL.SchemeIs().
18 extern const char kExtensionResourceScheme[];
19 
20 // The name of the manifest inside an extension.
21 extern const base::FilePath::CharType kManifestFilename[];
22 
23 // The name of locale folder inside an extension.
24 extern const base::FilePath::CharType kLocaleFolder[];
25 
26 // The name of the messages file inside an extension.
27 extern const base::FilePath::CharType kMessagesFilename[];
28 
29 // The base directory for subdirectories with platform-specific code.
30 extern const base::FilePath::CharType kPlatformSpecificFolder[];
31 
32 // A directory reserved for metadata, generated either by the webstore
33 // or chrome.
34 extern const base::FilePath::CharType kMetadataFolder[];
35 
36 // Name of the verified contents file within the metadata folder.
37 extern const base::FilePath::CharType kVerifiedContentsFilename[];
38 
39 // Name of the computed hashes file within the metadata folder.
40 extern const base::FilePath::CharType kComputedHashesFilename[];
41 
42 // The name of the directory inside the profile where extensions are
43 // installed to.
44 extern const char kInstallDirectoryName[];
45 
46 // The name of a temporary directory to install an extension into for
47 // validation before finalizing install.
48 extern const char kTempExtensionName[];
49 
50 // The file to write our decoded images to, relative to the extension_path.
51 extern const char kDecodedImagesFilename[];
52 
53 // The file to write our decoded message catalogs to, relative to the
54 // extension_path.
55 extern const char kDecodedMessageCatalogsFilename[];
56 
57 // The filename to use for a background page generated from
58 // background.scripts.
59 extern const char kGeneratedBackgroundPageFilename[];
60 
61 // Path to imported modules.
62 extern const char kModulesDir[];
63 
64 // The file extension (.crx) for extensions.
65 extern const base::FilePath::CharType kExtensionFileExtension[];
66 
67 // The file extension (.pem) for private key files.
68 extern const base::FilePath::CharType kExtensionKeyFileExtension[];
69 
70 // Default frequency for auto updates, if turned on.
71 extern const int kDefaultUpdateFrequencySeconds;
72 
73 // The name of the directory inside the profile where per-app local settings
74 // are stored.
75 extern const char kLocalAppSettingsDirectoryName[];
76 
77 // The name of the directory inside the profile where per-extension local
78 // settings are stored.
79 extern const char kLocalExtensionSettingsDirectoryName[];
80 
81 // The name of the directory inside the profile where per-app synced settings
82 // are stored.
83 extern const char kSyncAppSettingsDirectoryName[];
84 
85 // The name of the directory inside the profile where per-extension synced
86 // settings are stored.
87 extern const char kSyncExtensionSettingsDirectoryName[];
88 
89 // The name of the directory inside the profile where per-extension persistent
90 // managed settings are stored.
91 extern const char kManagedSettingsDirectoryName[];
92 
93 // The name of the database inside the profile where chrome-internal
94 // extension state resides.
95 extern const char kStateStoreName[];
96 
97 // The name of the database inside the profile where declarative extension
98 // rules are stored.
99 extern const char kRulesStoreName[];
100 
101 // The URL query parameter key corresponding to multi-login user index.
102 extern const char kAuthUserQueryKey[];
103 
104 // Mime type strings
105 extern const char kMimeTypeJpeg[];
106 extern const char kMimeTypePng[];
107 
108 // The extension id of the Web Store component application.
109 extern const char kWebStoreAppId[];
110 
111 }  // namespace extensions
112 
113 namespace extension_misc {
114 
115 // Matches chrome.windows.WINDOW_ID_NONE.
116 const int kUnknownWindowId = -1;
117 
118 // Matches chrome.windows.WINDOW_ID_CURRENT.
119 const int kCurrentWindowId = -2;
120 
121 // NOTE: If you change this list, you should also change kExtensionIconSizes
122 // in cc file.
123 enum ExtensionIcons {
124   EXTENSION_ICON_GIGANTOR = 512,
125   EXTENSION_ICON_EXTRA_LARGE = 256,
126   EXTENSION_ICON_LARGE = 128,
127   EXTENSION_ICON_MEDIUM = 48,
128   EXTENSION_ICON_SMALL = 32,
129   EXTENSION_ICON_SMALLISH = 24,
130   EXTENSION_ICON_ACTION = 19,
131   EXTENSION_ICON_BITTY = 16,
132   EXTENSION_ICON_INVALID = 0,
133 };
134 
135 // List of sizes for extension icons that can be defined in the manifest.
136 extern const int kExtensionIconSizes[];
137 extern const size_t kNumExtensionIconSizes;
138 
139 struct IconRepresentationInfo {
140   // Size in pixels.
141   const int size;
142   // Size as a string that will be used to retrieve representation value from
143   // ExtensionAction SetIcon function arguments.
144   const char* const size_string;
145   // Scale factor for which the representation should be used.
146   const ui::ScaleFactor scale;
147 };
148 
149 // The icon representations for extension actions.
150 extern const IconRepresentationInfo kExtensionActionIconSizes[];
151 const size_t kNumExtensionActionIconSizes = 2u;
152 
153 }  // namespace extension_misc
154 
155 #endif  // EXTENSIONS_COMMON_CONSTANTS_H_
156