Fix crash on app list start page contents not existing.
[chromium-blink-merge.git] / extensions / common / constants.h
blobb4a546bd7f53d1040cae669bfdbe83882ce56402
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.
5 #ifndef EXTENSIONS_COMMON_CONSTANTS_H_
6 #define EXTENSIONS_COMMON_CONSTANTS_H_
8 #include "base/basictypes.h"
9 #include "base/files/file_path.h"
10 #include "ui/base/layout.h"
12 namespace extensions {
14 // Scheme we serve extension content from.
15 extern const char kExtensionScheme[];
17 // Canonical schemes you can use as input to GURL.SchemeIs().
18 extern const char kExtensionResourceScheme[];
20 // The name of the manifest inside an extension.
21 extern const base::FilePath::CharType kManifestFilename[];
23 // The name of locale folder inside an extension.
24 extern const base::FilePath::CharType kLocaleFolder[];
26 // The name of the messages file inside an extension.
27 extern const base::FilePath::CharType kMessagesFilename[];
29 // The base directory for subdirectories with platform-specific code.
30 extern const base::FilePath::CharType kPlatformSpecificFolder[];
32 // A directory reserved for metadata, generated either by the webstore
33 // or chrome.
34 extern const base::FilePath::CharType kMetadataFolder[];
36 // Name of the verified contents file within the metadata folder.
37 extern const base::FilePath::CharType kVerifiedContentsFilename[];
39 // Name of the computed hashes file within the metadata folder.
40 extern const base::FilePath::CharType kComputedHashesFilename[];
42 // The name of the directory inside the profile where extensions are
43 // installed to.
44 extern const char kInstallDirectoryName[];
46 // The name of a temporary directory to install an extension into for
47 // validation before finalizing install.
48 extern const char kTempExtensionName[];
50 // The file to write our decoded images to, relative to the extension_path.
51 extern const char kDecodedImagesFilename[];
53 // The file to write our decoded message catalogs to, relative to the
54 // extension_path.
55 extern const char kDecodedMessageCatalogsFilename[];
57 // The filename to use for a background page generated from
58 // background.scripts.
59 extern const char kGeneratedBackgroundPageFilename[];
61 // Path to imported modules.
62 extern const char kModulesDir[];
64 // The file extension (.crx) for extensions.
65 extern const base::FilePath::CharType kExtensionFileExtension[];
67 // The file extension (.pem) for private key files.
68 extern const base::FilePath::CharType kExtensionKeyFileExtension[];
70 // Default frequency for auto updates, if turned on.
71 extern const int kDefaultUpdateFrequencySeconds;
73 // The name of the directory inside the profile where per-app local settings
74 // are stored.
75 extern const char kLocalAppSettingsDirectoryName[];
77 // The name of the directory inside the profile where per-extension local
78 // settings are stored.
79 extern const char kLocalExtensionSettingsDirectoryName[];
81 // The name of the directory inside the profile where per-app synced settings
82 // are stored.
83 extern const char kSyncAppSettingsDirectoryName[];
85 // The name of the directory inside the profile where per-extension synced
86 // settings are stored.
87 extern const char kSyncExtensionSettingsDirectoryName[];
89 // The name of the directory inside the profile where per-extension persistent
90 // managed settings are stored.
91 extern const char kManagedSettingsDirectoryName[];
93 // The name of the database inside the profile where chrome-internal
94 // extension state resides.
95 extern const char kStateStoreName[];
97 // The name of the database inside the profile where declarative extension
98 // rules are stored.
99 extern const char kRulesStoreName[];
101 // The URL query parameter key corresponding to multi-login user index.
102 extern const char kAuthUserQueryKey[];
104 // Mime type strings
105 extern const char kMimeTypeJpeg[];
106 extern const char kMimeTypePng[];
108 // The extension id of the Web Store component application.
109 extern const char kWebStoreAppId[];
111 // Enumeration of possible app launch sources.
112 // Note the enumeration is used in UMA histogram so entries
113 // should not be re-ordered or removed.
114 enum AppLaunchSource {
115 SOURCE_UNTRACKED = 0,
116 SOURCE_APP_LAUNCHER,
117 SOURCE_NEW_TAB_PAGE,
118 SOURCE_RELOAD,
119 SOURCE_RESTART,
120 SOURCE_LOAD_AND_LAUNCH,
121 SOURCE_COMMAND_LINE,
122 SOURCE_FILE_HANDLER,
123 SOURCE_URL_HANDLER,
124 SOURCE_SYSTEM_TRAY,
125 SOURCE_ABOUT_PAGE,
126 SOURCE_KEYBOARD,
127 SOURCE_EXTENSIONS_PAGE,
128 SOURCE_MANAGEMENT_API,
129 SOURCE_EPHEMERAL_APP,
130 SOURCE_BACKGROUND,
131 SOURCE_KIOSK,
132 SOURCE_CHROME_INTERNAL,
133 SOURCE_TEST,
135 NUM_APP_LAUNCH_SOURCES
138 // This enum is used for the launch type the user wants to use for an
139 // application.
140 // Do not remove items or re-order this enum as it is used in preferences
141 // and histograms.
142 enum LaunchType {
143 LAUNCH_TYPE_INVALID = -1,
144 LAUNCH_TYPE_FIRST = 0,
145 LAUNCH_TYPE_PINNED = LAUNCH_TYPE_FIRST,
146 LAUNCH_TYPE_REGULAR = 1,
147 LAUNCH_TYPE_FULLSCREEN = 2,
148 LAUNCH_TYPE_WINDOW = 3,
149 NUM_LAUNCH_TYPES,
151 // Launch an app in the in the way a click on the NTP would,
152 // if no user pref were set. Update this constant to change
153 // the default for the NTP and chrome.management.launchApp().
154 LAUNCH_TYPE_DEFAULT = LAUNCH_TYPE_REGULAR
157 // Don't remove items or change the order of this enum. It's used in
158 // histograms and preferences.
159 enum LaunchContainer {
160 LAUNCH_CONTAINER_WINDOW,
161 LAUNCH_CONTAINER_PANEL,
162 LAUNCH_CONTAINER_TAB,
163 // For platform apps, which don't actually have a container (they just get a
164 // "onLaunched" event).
165 LAUNCH_CONTAINER_NONE,
166 NUM_LAUNCH_CONTAINERS
169 } // namespace extensions
171 namespace extension_misc {
173 // Matches chrome.windows.WINDOW_ID_NONE.
174 const int kUnknownWindowId = -1;
176 // Matches chrome.windows.WINDOW_ID_CURRENT.
177 const int kCurrentWindowId = -2;
179 // NOTE: If you change this list, you should also change kExtensionIconSizes
180 // in cc file.
181 enum ExtensionIcons {
182 EXTENSION_ICON_GIGANTOR = 512,
183 EXTENSION_ICON_EXTRA_LARGE = 256,
184 EXTENSION_ICON_LARGE = 128,
185 EXTENSION_ICON_MEDIUM = 48,
186 EXTENSION_ICON_SMALL = 32,
187 EXTENSION_ICON_SMALLISH = 24,
188 EXTENSION_ICON_ACTION = 19,
189 EXTENSION_ICON_BITTY = 16,
190 EXTENSION_ICON_INVALID = 0,
193 // List of sizes for extension icons that can be defined in the manifest.
194 extern const int kExtensionIconSizes[];
195 extern const size_t kNumExtensionIconSizes;
197 struct IconRepresentationInfo {
198 // Size in pixels.
199 const int size;
200 // Size as a string that will be used to retrieve representation value from
201 // ExtensionAction SetIcon function arguments.
202 const char* const size_string;
203 // Scale factor for which the representation should be used.
204 const ui::ScaleFactor scale;
207 // The icon representations for extension actions.
208 extern const IconRepresentationInfo kExtensionActionIconSizes[];
209 const size_t kNumExtensionActionIconSizes = 2u;
211 // The extension id of the PDF extension.
212 extern const char kPdfExtensionId[];
214 // The extension id of the Office Viewer component extension.
215 extern const char kQuickOfficeComponentExtensionId[];
217 // The extension id of the Office Viewer extension on the internal webstore.
218 extern const char kQuickOfficeInternalExtensionId[];
220 // The extension id of the Office Viewer extension.
221 extern const char kQuickOfficeExtensionId[];
223 // The extension id used for testing mimeHandlerPrivate.
224 extern const char kMimeHandlerPrivateTestExtensionId[];
226 } // namespace extension_misc
228 #endif // EXTENSIONS_COMMON_CONSTANTS_H_