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#include "chrome/common/chrome_constants.h"
6
7#include "base/files/file_path.h"
8
9#define FPL FILE_PATH_LITERAL
10
11#if defined(OS_MACOSX)
12#define CHROMIUM_PRODUCT_STRING "Chromium"
13#if defined(GOOGLE_CHROME_BUILD)
14#define PRODUCT_STRING "Google Chrome"
15#elif defined(CHROMIUM_BUILD)
16#define PRODUCT_STRING "Chromium"
17#else
18#error Unknown branding
19#endif
20#endif  // defined(OS_MACOSX)
21
22#if defined(OS_WIN)
23#if defined(GOOGLE_CHROME_BUILD)
24#define PRODUCT_STRING_PATH L"Google\\Chrome"
25#elif defined(CHROMIUM_BUILD)
26#define PRODUCT_STRING_PATH L"Chromium"
27#else
28#error Unknown branding
29#endif
30#endif  // defined(OS_WIN)
31
32namespace chrome {
33
34const char kChromeVersionEnvVar[] = "CHROME_VERSION";
35
36// The following should not be used for UI strings; they are meant
37// for system strings only. UI changes should be made in the GRD.
38//
39// There are four constants used to locate the executable name and path:
40//
41//     kBrowserProcessExecutableName
42//     kHelperProcessExecutableName
43//     kBrowserProcessExecutablePath
44//     kHelperProcessExecutablePath
45//
46// In one condition, our tests will be built using the Chrome branding
47// though we want to actually execute a Chromium branded application.
48// This happens for the reference build on Mac.  To support that case,
49// we also include a Chromium version of each of the four constants and
50// in the UITest class we support switching to that version when told to
51// do so.
52
53#if defined(OS_WIN)
54const base::FilePath::CharType kBrowserProcessExecutableNameChromium[] =
55    FPL("chrome.exe");
56const base::FilePath::CharType kBrowserProcessExecutableName[] =
57    FPL("chrome.exe");
58const base::FilePath::CharType kHelperProcessExecutableNameChromium[] =
59    FPL("chrome.exe");
60const base::FilePath::CharType kHelperProcessExecutableName[] =
61    FPL("chrome.exe");
62#elif defined(OS_MACOSX)
63const base::FilePath::CharType kBrowserProcessExecutableNameChromium[] =
64    FPL(CHROMIUM_PRODUCT_STRING);
65const base::FilePath::CharType kBrowserProcessExecutableName[] =
66    FPL(PRODUCT_STRING);
67const base::FilePath::CharType kHelperProcessExecutableNameChromium[] =
68    FPL(CHROMIUM_PRODUCT_STRING " Helper");
69const base::FilePath::CharType kHelperProcessExecutableName[] =
70    FPL(PRODUCT_STRING " Helper");
71#elif defined(OS_ANDROID)
72// NOTE: Keep it synced with the process names defined in AndroidManifest.xml.
73const base::FilePath::CharType kBrowserProcessExecutableName[] = FPL("chrome");
74const base::FilePath::CharType kBrowserProcessExecutableNameChromium[] =
75    FPL("");
76const base::FilePath::CharType kHelperProcessExecutableName[] =
77    FPL("sandboxed_process");
78const base::FilePath::CharType kHelperProcessExecutableNameChromium[] = FPL("");
79#elif defined(OS_POSIX)
80const base::FilePath::CharType kBrowserProcessExecutableNameChromium[] =
81    FPL("chrome");
82const base::FilePath::CharType kBrowserProcessExecutableName[] = FPL("chrome");
83// Helper processes end up with a name of "exe" due to execing via
84// /proc/self/exe.  See bug 22703.
85const base::FilePath::CharType kHelperProcessExecutableNameChromium[] =
86    FPL("exe");
87const base::FilePath::CharType kHelperProcessExecutableName[] = FPL("exe");
88#endif  // OS_*
89
90#if defined(OS_WIN)
91const base::FilePath::CharType kBrowserProcessExecutablePathChromium[] =
92    FPL("chrome.exe");
93const base::FilePath::CharType kBrowserProcessExecutablePath[] =
94    FPL("chrome.exe");
95const base::FilePath::CharType kHelperProcessExecutablePathChromium[] =
96    FPL("chrome.exe");
97const base::FilePath::CharType kHelperProcessExecutablePath[] =
98    FPL("chrome.exe");
99#elif defined(OS_MACOSX)
100const base::FilePath::CharType kBrowserProcessExecutablePathChromium[] =
101    FPL(CHROMIUM_PRODUCT_STRING ".app/Contents/MacOS/" CHROMIUM_PRODUCT_STRING);
102const base::FilePath::CharType kBrowserProcessExecutablePath[] =
103    FPL(PRODUCT_STRING ".app/Contents/MacOS/" PRODUCT_STRING);
104const base::FilePath::CharType kHelperProcessExecutablePathChromium[] =
105    FPL(CHROMIUM_PRODUCT_STRING " Helper.app/Contents/MacOS/"
106        CHROMIUM_PRODUCT_STRING " Helper");
107const base::FilePath::CharType kHelperProcessExecutablePath[] =
108    FPL(PRODUCT_STRING " Helper.app/Contents/MacOS/" PRODUCT_STRING " Helper");
109#elif defined(OS_ANDROID)
110const base::FilePath::CharType kBrowserProcessExecutablePath[] = FPL("chrome");
111const base::FilePath::CharType kHelperProcessExecutablePath[] = FPL("chrome");
112const base::FilePath::CharType kBrowserProcessExecutablePathChromium[] =
113    FPL("chrome");
114const base::FilePath::CharType kHelperProcessExecutablePathChromium[] =
115    FPL("chrome");
116#elif defined(OS_POSIX)
117const base::FilePath::CharType kBrowserProcessExecutablePathChromium[] =
118    FPL("chrome");
119const base::FilePath::CharType kBrowserProcessExecutablePath[] = FPL("chrome");
120const base::FilePath::CharType kHelperProcessExecutablePathChromium[] =
121    FPL("chrome");
122const base::FilePath::CharType kHelperProcessExecutablePath[] = FPL("chrome");
123#endif  // OS_*
124
125#if defined(OS_MACOSX)
126const base::FilePath::CharType kFrameworkName[] =
127    FPL(PRODUCT_STRING " Framework.framework");
128
129const char* const kHelperFlavorSuffixes[] = {
130  FPL("EH"),  // Executable heap
131  FPL("NP"),  // No PIE
132  NULL
133};
134#endif  // OS_MACOSX
135
136#if defined(OS_WIN)
137const base::FilePath::CharType kMetroDriverDll[] = FPL("metro_driver.dll");
138const wchar_t kStatusTrayWindowClass[] = L"Chrome_StatusTrayWindow";
139#endif  // defined(OS_WIN)
140
141const wchar_t kCrashReportLog[] = L"Reported Crashes.txt";
142const wchar_t kTestingInterfaceDLL[] = L"testing_interface.dll";
143const char    kInitialProfile[] = "Default";
144const char    kMultiProfileDirPrefix[] = "Profile ";
145const base::FilePath::CharType kGuestProfileDir[] = FPL("Guest Profile");
146const wchar_t kBrowserResourcesDll[] = L"chrome.dll";
147
148// filenames
149#if defined(OS_ANDROID)
150const base::FilePath::CharType kAndroidCacheFilename[] = FPL("AndroidCache");
151#endif
152const base::FilePath::CharType kArchivedHistoryFilename[] =
153    FPL("Archived History");
154const base::FilePath::CharType kCacheDirname[] = FPL("Cache");
155const base::FilePath::CharType kCookieFilename[] = FPL("Cookies");
156const base::FilePath::CharType kCRLSetFilename[] =
157    FPL("Certificate Revocation Lists");
158const base::FilePath::CharType kCLDDataFilename[] =
159    FPL("cld2_data.bin");
160const base::FilePath::CharType kCustomDictionaryFileName[] =
161    FPL("Custom Dictionary.txt");
162const base::FilePath::CharType kExtensionActivityLogFilename[] =
163    FPL("Extension Activity");
164const base::FilePath::CharType kExtensionsCookieFilename[] =
165    FPL("Extension Cookies");
166const base::FilePath::CharType kFaviconsFilename[] = FPL("Favicons");
167const base::FilePath::CharType kFirstRunSentinel[] = FPL("First Run");
168const base::FilePath::CharType kGCMStoreDirname[] = FPL("GCM Store");
169const base::FilePath::CharType kHistoryFilename[] = FPL("History");
170const base::FilePath::CharType kJumpListIconDirname[] = FPL("JumpListIcons");
171const base::FilePath::CharType kLocalStateFilename[] = FPL("Local State");
172const base::FilePath::CharType kLocalStorePoolName[] = FPL("LocalStorePool");
173const base::FilePath::CharType kLoginDataFileName[] = FPL("Login Data");
174const base::FilePath::CharType kSupervisedUserSettingsFilename[] =
175    FPL("Managed Mode Settings");
176const base::FilePath::CharType kMediaCacheDirname[] = FPL("Media Cache");
177const base::FilePath::CharType kNewTabThumbnailsFilename[] =
178    FPL("Top Thumbnails");
179const base::FilePath::CharType kOBCertFilename[] = FPL("Origin Bound Certs");
180const base::FilePath::CharType kPreferencesFilename[] = FPL("Preferences");
181const base::FilePath::CharType kProtectedPreferencesFilenameDeprecated[] =
182    FPL("Protected Preferences");
183const base::FilePath::CharType kReadmeFilename[] = FPL("README");
184const base::FilePath::CharType kResetPromptMementoFilename[] =
185    FPL("Reset Prompt Memento");
186const base::FilePath::CharType kSafeBrowsingBaseFilename[] =
187    FPL("Safe Browsing");
188const base::FilePath::CharType kSecurePreferencesFilename[] =
189    FPL("Secure Preferences");
190const base::FilePath::CharType kServiceStateFileName[] = FPL("Service State");
191const base::FilePath::CharType kShortcutsDatabaseName[] = FPL("Shortcuts");
192const base::FilePath::CharType kSingletonCookieFilename[] =
193    FPL("SingletonCookie");
194const base::FilePath::CharType kSingletonLockFilename[] = FPL("SingletonLock");
195const base::FilePath::CharType kSingletonSocketFilename[] =
196    FPL("SingletonSocket");
197const base::FilePath::CharType kSyncCredentialsFilename[] =
198    FPL("Sync Credentials");
199const base::FilePath::CharType kThemePackFilename[] = FPL("Cached Theme.pak");
200const base::FilePath::CharType kThumbnailsFilename[] = FPL("Thumbnails");
201const base::FilePath::CharType kTopSitesFilename[] = FPL("Top Sites");
202const base::FilePath::CharType kWebAppDirname[] = FPL("Web Applications");
203
204// File name of the Pepper Flash plugin on different platforms.
205const base::FilePath::CharType kPepperFlashPluginFilename[] =
206#if defined(OS_MACOSX)
207    FPL("PepperFlashPlayer.plugin");
208#elif defined(OS_WIN)
209    FPL("pepflashplayer.dll");
210#else  // OS_LINUX, etc.
211    FPL("libpepflashplayer.so");
212#endif
213
214// directory names
215const wchar_t kUserDataDirname[] = L"User Data";
216
217// We don't enable record mode in the released product because users could
218// potentially be tricked into running a product in record mode without
219// knowing it.  Enable in debug builds.  Playback mode is allowed always,
220// because it is useful for testing and not hazardous by itself.
221#ifndef NDEBUG
222// const bool kRecordModeEnabled = true;
223#else
224// const bool kRecordModeEnabled = false;
225#endif
226
227const bool kRecordModeEnabled = true;
228
229const int kJavaScriptMessageExpectedDelay = 1000;
230
231#if defined(OS_ANDROID)
232const bool kEnableTouchIcon = true;
233#else
234const bool kEnableTouchIcon = false;
235#endif
236
237const float kMaxShareOfExtensionProcesses = 0.30f;
238
239// This is used by the PreRead experiment.
240const char kPreReadEnvironmentVariable[] = "CHROME_PRE_READ_EXPERIMENT";
241
242#if defined(OS_LINUX)
243const int kLowestRendererOomScore = 300;
244const int kHighestRendererOomScore = 1000;
245#endif
246
247#if defined(OS_WIN)
248const wchar_t kMetroNavigationAndSearchMessage[] =
249    L"CHROME_METRO_NAV_SEARCH_REQUEST";
250const wchar_t kMetroGetCurrentTabInfoMessage[] =
251    L"CHROME_METRO_GET_CURRENT_TAB_INFO";
252const wchar_t kMetroRegistryPath[] =
253    L"Software\\" PRODUCT_STRING_PATH L"\\Metro";
254const wchar_t kLaunchModeValue[] = L"launch_mode";
255// This is used by breakpad and the metrics reporting.
256const wchar_t kBrowserCrashDumpAttemptsRegistryPath[] =
257    L"Software\\" PRODUCT_STRING_PATH L"\\BrowserCrashDumpAttempts";
258const char kSafeModeEnvVar[] = "CHROME_SAFE_MODE";
259#endif
260
261#if defined(OS_CHROMEOS)
262const char kProfileDirPrefix[] = "u-";
263const char kLegacyProfileDir[] = "user";
264const char kTestUserProfileDir[] = "test-user";
265#endif
266
267// This GUID is associated with any 'don't ask me again' settings that the
268// user can select for different file types.
269// {2676A9A2-D919-4FEE-9187-152100393AB2}
270const char kApplicationClientIDStringForAVScanning[] =
271    "2676A9A2-D919-4FEE-9187-152100393AB2";
272
273#if defined(OS_ANDROID)
274const size_t kMaxMetaTagAttributeLength = 2000;
275#endif
276
277}  // namespace chrome
278
279#undef FPL
280