Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / chrome / common / mac / app_mode_common.h
blob8527583082f2465b0cea1b607fd4e7b24f098a4b
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 CHROME_COMMON_MAC_APP_MODE_COMMON_H_
6 #define CHROME_COMMON_MAC_APP_MODE_COMMON_H_
8 #import <Foundation/Foundation.h>
10 #include "base/files/file_path.h"
11 #include "base/strings/string16.h"
13 // This file contains constants, interfaces, etc. which are common to the
14 // browser application and the app mode loader (a.k.a. shim).
16 namespace app_mode {
18 // These are keys for an Apple Event ping that the app shim process sends to
19 // Chrome to get confirmation that Chrome is alive. The main Chrome process
20 // doesn't need to register any handlers for them -- the event is just sent for
21 // the empty reply that's automatically returned by the system.
22 const AEEventClass kAEChromeAppClass = 'cApp';
23 const AEEventID kAEChromeAppPing = 'ping';
25 // The IPC socket used to communicate between app shims and Chrome will be
26 // created under a temporary directory with this name.
27 extern const char kAppShimSocketShortName[];
28 // A symlink to allow the app shim to find the socket will be created under the
29 // user data dir with this name.
30 extern const char kAppShimSocketSymlinkName[];
32 // A symlink used to store the version string of the currently running Chrome.
33 // The shim will read this to determine which version of the framework to load.
34 extern const char kRunningChromeVersionSymlinkName[];
36 // Special app mode id used for the App Launcher.
37 extern const char kAppListModeId[];
39 // The process ID of the Chrome process that launched the app shim.
40 // The presence of this switch instructs the app shim to send LaunchApp with
41 // launch_now = false. This associates the shim without launching the app.
42 extern const char kLaunchedByChromeProcessId[];
44 // Indicates to the shim that it was launched for a test, so don't attempt to
45 // launch Chrome.
46 extern const char kLaunchedForTest[];
48 // Indicates to the shim that this Chrome has rebuilt it once already, i.e. if
49 // it fails to launch again, don't trigger another rebuild.
50 extern const char kLaunchedAfterRebuild[];
52 // Path to an app shim bundle. Indicates to Chrome that this shim attempted to
53 // launch but failed.
54 extern const char kAppShimError[];
56 // Keys for specifying the file types handled by an app.
57 extern NSString* const kCFBundleDocumentTypesKey;
58 extern NSString* const kCFBundleTypeExtensionsKey;
59 extern NSString* const kCFBundleTypeIconFileKey;
60 extern NSString* const kCFBundleTypeNameKey;
61 extern NSString* const kCFBundleTypeMIMETypesKey;
62 extern NSString* const kCFBundleTypeRoleKey;
63 extern NSString* const kBundleTypeRoleViewer;
65 // The display name of the bundle as shown in Finder and the Dock. For localized
66 // bundles, this overrides the bundle's file name.
67 extern NSString* const kCFBundleDisplayNameKey;
69 // When Chrome is built, any app bundles (e.g. the app shim template bundle)
70 // will have their CFBundleShortVersionString set to the full version string of
71 // that build. Since, this string is used by OSX when displaying an app bundle's
72 // version, we override it in app shim bundles to show the app's version
73 // instead.
74 extern NSString* const kCFBundleShortVersionStringKey;
76 // Key for the Chrome version that built the app shim bundle. This needs to be
77 // added since we override CFBundleShortVersionString with the version of the
78 // app.
79 extern NSString* const kCrBundleVersionKey;
81 // The key specifying whether the display name should be localized. This makes
82 // Finder look in localization folders in the app bundle for a display name.
83 // (e.g. Content/Resources/en.lproj/)
84 extern NSString* const kLSHasLocalizedDisplayNameKey;
86 // The key under which the browser's bundle ID will be stored in the
87 // app mode launcher bundle's Info.plist.
88 extern NSString* const kBrowserBundleIDKey;
90 // Key for the shortcut ID.
91 extern NSString* const kCrAppModeShortcutIDKey;
93 // Key for the app's name.
94 extern NSString* const kCrAppModeShortcutNameKey;
96 // Key for the app's URL.
97 extern NSString* const kCrAppModeShortcutURLKey;
99 // Key for the app user data directory.
100 extern NSString* const kCrAppModeUserDataDirKey;
102 // Key for the app's extension path.
103 extern NSString* const kCrAppModeProfileDirKey;
105 // Key for the app's profile display name.
106 extern NSString* const kCrAppModeProfileNameKey;
108 // When the Chrome browser is run, it stores its location in the defaults
109 // system using this key.
110 extern NSString* const kLastRunAppBundlePathPrefsKey;
112 // Placeholders used in the app mode loader bundle' Info.plist:
113 extern NSString* const kShortcutIdPlaceholder; // Extension shortcut ID.
114 extern NSString* const kShortcutNamePlaceholder; // Extension name.
115 extern NSString* const kShortcutURLPlaceholder;
116 // Bundle ID of the Chrome browser bundle.
117 extern NSString* const kShortcutBrowserBundleIDPlaceholder;
119 // Current major/minor version numbers of |ChromeAppModeInfo| (defined below).
120 const unsigned kCurrentChromeAppModeInfoMajorVersion = 1;
121 const unsigned kCurrentChromeAppModeInfoMinorVersion = 3;
123 // The structure used to pass information from the app mode loader to the
124 // (browser) framework. This is versioned using major and minor version numbers,
125 // written below as v<major>.<minor>. Version-number checking is done by the
126 // framework, and the framework must accept all structures with the same major
127 // version number. It may refuse to load if the major version of the structure
128 // is different from the one it accepts.
129 struct ChromeAppModeInfo {
130 public:
131 ChromeAppModeInfo();
132 ~ChromeAppModeInfo();
134 // Major and minor version number of this structure.
135 unsigned major_version; // Required: all versions
136 unsigned minor_version; // Required: all versions
138 // Original |argc| and |argv|.
139 int argc; // Required: v1.0
140 char** argv; // Required: v1.0
142 // Versioned path to the browser which is being loaded.
143 base::FilePath chrome_versioned_path; // Required: v1.0
145 // Path to Chrome app bundle.
146 base::FilePath chrome_outer_bundle_path; // Required: v1.0
148 // Information about the App Mode shortcut:
150 // Path to the App Mode Loader application bundle that launched the process.
151 base::FilePath app_mode_bundle_path; // Optional: v1.0
153 // Short ID string, preferably derived from |app_mode_short_name|. Should be
154 // safe for the file system.
155 std::string app_mode_id; // Required: v1.0
157 // Unrestricted (e.g., several-word) UTF8-encoded name for the shortcut.
158 base::string16 app_mode_name; // Optional: v1.0
160 // URL for the shortcut. Must be a valid URL.
161 std::string app_mode_url; // Required: v1.0
163 // Path to the app's user data directory.
164 base::FilePath user_data_dir;
166 // Directory of the profile associated with the app.
167 base::FilePath profile_dir;
170 // Check that the socket and its parent directory have the correct permissions
171 // and are owned by the user.
172 void VerifySocketPermissions(const base::FilePath& socket_path);
174 } // namespace app_mode
176 #endif // CHROME_COMMON_MAC_APP_MODE_COMMON_H_