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/files/file_path.h"
9#include "base/logging.h"
10#include "ui/base/layout.h"
11
12namespace extensions {
13
14// Scheme we serve extension content from.
15extern const char kExtensionScheme[];
16
17// The name of the manifest inside an extension.
18extern const base::FilePath::CharType kManifestFilename[];
19
20// The name of locale folder inside an extension.
21extern const base::FilePath::CharType kLocaleFolder[];
22
23// The name of the messages file inside an extension.
24extern const base::FilePath::CharType kMessagesFilename[];
25
26// The base directory for subdirectories with platform-specific code.
27extern const base::FilePath::CharType kPlatformSpecificFolder[];
28
29// A directory reserved for metadata, generated either by the webstore
30// or chrome.
31extern const base::FilePath::CharType kMetadataFolder[];
32
33// Name of the verified contents file within the metadata folder.
34extern const base::FilePath::CharType kVerifiedContentsFilename[];
35
36// Name of the computed hashes file within the metadata folder.
37extern const base::FilePath::CharType kComputedHashesFilename[];
38
39// Name of the indexed ruleset file for the Declarative Net Request API.
40extern const base::FilePath::CharType kIndexedRulesetFilename[];
41
42// The name of the directory inside the profile where extensions are
43// installed to.
44extern const char kInstallDirectoryName[];
45
46// The name of a temporary directory to install an extension into for
47// validation before finalizing install.
48extern const char kTempExtensionName[];
49
50// The file to write our decoded message catalogs to, relative to the
51// extension_path.
52extern const char kDecodedMessageCatalogsFilename[];
53
54// The filename to use for a background page generated from
55// background.scripts.
56extern const char kGeneratedBackgroundPageFilename[];
57
58// Path to imported modules.
59extern const char kModulesDir[];
60
61// The file extension (.crx) for extensions.
62extern const base::FilePath::CharType kExtensionFileExtension[];
63
64// The file extension (.pem) for private key files.
65extern const base::FilePath::CharType kExtensionKeyFileExtension[];
66
67// Default frequency for auto updates, if turned on.
68extern const int kDefaultUpdateFrequencySeconds;
69
70// The name of the directory inside the profile where per-app local settings
71// are stored.
72extern const char kLocalAppSettingsDirectoryName[];
73
74// The name of the directory inside the profile where per-extension local
75// settings are stored.
76extern const char kLocalExtensionSettingsDirectoryName[];
77
78// The name of the directory inside the profile where per-app synced settings
79// are stored.
80extern const char kSyncAppSettingsDirectoryName[];
81
82// The name of the directory inside the profile where per-extension synced
83// settings are stored.
84extern const char kSyncExtensionSettingsDirectoryName[];
85
86// The name of the directory inside the profile where per-extension persistent
87// managed settings are stored.
88extern const char kManagedSettingsDirectoryName[];
89
90// The name of the database inside the profile where chrome-internal
91// extension state resides.
92extern const char kStateStoreName[];
93
94// The name of the database inside the profile where declarative extension
95// rules are stored.
96extern const char kRulesStoreName[];
97
98// The URL query parameter key corresponding to multi-login user index.
99extern const char kAuthUserQueryKey[];
100
101// Mime type strings
102extern const char kMimeTypeJpeg[];
103extern const char kMimeTypePng[];
104
105// The extension id of the Web Store component application.
106extern const char kWebStoreAppId[];
107
108// The key used for signing some pieces of data from the webstore.
109extern const uint8_t kWebstoreSignaturesPublicKey[];
110extern const size_t kWebstoreSignaturesPublicKeySize;
111
112// Thread identifier for the main renderer thread (as opposed to a service
113// worker thread).
114// This is the default thread id used for extension event listeners registered
115// from a non-service worker context
116extern const int kMainThreadId;
117
118// Enumeration of possible app launch sources.
119// This should be kept in sync with LaunchSource in
120// extensions/common/api/app_runtime.idl, and GetLaunchSourceEnum() in
121// extensions/browser/api/app_runtime/app_runtime_api.cc.
122// Note the enumeration is used in UMA histogram so entries
123// should not be re-ordered or removed.
124enum AppLaunchSource {
125 SOURCE_NONE,
126 SOURCE_UNTRACKED,
127 SOURCE_APP_LAUNCHER,
128 SOURCE_NEW_TAB_PAGE,
129 SOURCE_RELOAD,
130 SOURCE_RESTART,
131 SOURCE_LOAD_AND_LAUNCH,
132 SOURCE_COMMAND_LINE,
133 SOURCE_FILE_HANDLER,
134 SOURCE_URL_HANDLER,
135 SOURCE_SYSTEM_TRAY,
136 SOURCE_ABOUT_PAGE,
137 SOURCE_KEYBOARD,
138 SOURCE_EXTENSIONS_PAGE,
139 SOURCE_MANAGEMENT_API,
140 SOURCE_EPHEMERAL_APP_DEPRECATED,
141 SOURCE_BACKGROUND,
142 SOURCE_KIOSK,
143 SOURCE_CHROME_INTERNAL,
144 SOURCE_TEST,
145 SOURCE_INSTALLED_NOTIFICATION,
146 SOURCE_CONTEXT_MENU,
147 SOURCE_ARC,
148 NUM_APP_LAUNCH_SOURCES
149};
150
151// This enum is used for the launch type the user wants to use for an
152// application.
153// Do not remove items or re-order this enum as it is used in preferences
154// and histograms.
155enum LaunchType {
156 LAUNCH_TYPE_INVALID = -1,
157 LAUNCH_TYPE_FIRST = 0,
158 LAUNCH_TYPE_PINNED = LAUNCH_TYPE_FIRST,
159 LAUNCH_TYPE_REGULAR = 1,
160 LAUNCH_TYPE_FULLSCREEN = 2,
161 LAUNCH_TYPE_WINDOW = 3,
162 NUM_LAUNCH_TYPES,
163
164 // Launch an app in the in the way a click on the NTP would,
165 // if no user pref were set. Update this constant to change
166 // the default for the NTP and chrome.management.launchApp().
167 LAUNCH_TYPE_DEFAULT = LAUNCH_TYPE_REGULAR
168};
169
170// Don't remove items or change the order of this enum. It's used in
171// histograms and preferences.
172enum LaunchContainer {
173 LAUNCH_CONTAINER_WINDOW,
174 LAUNCH_CONTAINER_PANEL_DEPRECATED,
175 LAUNCH_CONTAINER_TAB,
176 // For platform apps, which don't actually have a container (they just get a
177 // "onLaunched" event).
178 LAUNCH_CONTAINER_NONE,
179 NUM_LAUNCH_CONTAINERS
180};
181
182// The origin of injected CSS.
183enum CSSOrigin { CSS_ORIGIN_AUTHOR, CSS_ORIGIN_USER };
184static const CSSOrigin CSS_ORIGIN_LAST = CSS_ORIGIN_USER;
185
186} // namespace extensions
187
188namespace extension_misc {
189
190// Matches chrome.tabs.TAB_ID_NONE.
191const int kUnknownTabId = -1;
192
193// Matches chrome.windows.WINDOW_ID_NONE.
194const int kUnknownWindowId = -1;
195
196// Matches chrome.windows.WINDOW_ID_CURRENT.
197const int kCurrentWindowId = -2;
198
199enum ExtensionIcons {
200 EXTENSION_ICON_GIGANTOR = 512,
201 EXTENSION_ICON_EXTRA_LARGE = 256,
202 EXTENSION_ICON_LARGE = 128,
203 EXTENSION_ICON_MEDIUM = 48,
204 EXTENSION_ICON_SMALL = 32,
205 EXTENSION_ICON_SMALLISH = 24,
206 EXTENSION_ICON_BITTY = 16,
207 EXTENSION_ICON_INVALID = 0,
208};
209
210// The extension id of the ChromeVox extension.
211extern const char kChromeVoxExtensionId[];
212
213// The extension id of the feedback component extension.
214extern const char kFeedbackExtensionId[];
215
216// The extension id of the PDF extension.
217extern const char kPdfExtensionId[];
218
219// The extension id of the Office Viewer component extension.
220extern const char kQuickOfficeComponentExtensionId[];
221
222// The extension id of the Office Viewer extension on the internal webstore.
223extern const char kQuickOfficeInternalExtensionId[];
224
225// The extension id of the Office Viewer extension.
226extern const char kQuickOfficeExtensionId[];
227
228// The extension id used for testing mimeHandlerPrivate.
229extern const char kMimeHandlerPrivateTestExtensionId[];
230
231// The extension id of the Camera application.
232extern const char kCameraAppId[];
233
234// The extension id of the Chrome component application.
235extern const char kChromeAppId[];
236
237// The extension id of the Files Manager application.
238extern const char kFilesManagerAppId[];
239
240// The extension id of the Google Keep application.
241extern const char kGoogleKeepAppId[];
242
243// The extension id of the Youtube application.
244extern const char kYoutubeAppId[];
245
246// The extension id of the genius (Get Help) app.
247extern const char kGeniusAppId[];
248
249#if defined(OS_CHROMEOS)
250// The extension id of the default Demo Mode Highlights app.
251extern const char kHighlightsAppId[];
252
253// The extension id of the eve Demo Mode Highlights app.
254extern const char kHighlightsEveAppId[];
255
256// The extension id of the nocturne Demo Mode Highlights app.
257extern const char kHighlightsNocturneAppId[];
258
259// The extension id of an alternate Demo Mode Highlights app.
260extern const char kHighlightsAltAppId[];
261
262// The extension id of the default Demo Mode screensaver app.
263extern const char kScreensaverAppId[];
264
265// The extension id of the eve Demo Mode screensaver app.
266extern const char kScreensaverEveAppId[];
267
268// The extension id of the nocturne Demo Mode screensaver app.
269extern const char kScreensaverNocturneAppId[];
270
271// The extension id of an alternate Demo Mode screensaver app.
272extern const char kScreensaverAltAppId[];
273#endif
274
275// The extension id for the production version of Hangouts.
276extern const char kProdHangoutsExtensionId[];
277
278// Extension ids used by Hangouts.
279extern const char* const kHangoutsExtensionIds[6];
280
281// Error message when enterprise policy blocks scripting of webpage.
282extern const char kPolicyBlockedScripting[];
283
284// The default block size for hashing used in content verification.
285extern const int kContentVerificationDefaultBlockSize;
286
287// The minimum severity of a log or error in order to report it to the browser.
288extern const logging::LogSeverity kMinimumSeverityToReportError;
289
290} // namespace extension_misc
291
292#endif // EXTENSIONS_COMMON_CONSTANTS_H_
293