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).
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 the user data directory with this name.
27 extern const char kAppShimSocketName
[];
29 // Special app mode id used for the App Launcher.
30 extern const char kAppListModeId
[];
32 // The process ID of the Chrome process that launched the app shim.
33 // The presence of this switch instructs the app shim to send LaunchApp with
34 // launch_now = false. This associates the shim without launching the app.
35 extern const char kLaunchedByChromeProcessId
[];
37 // The display name of the bundle as shown in Finder and the Dock. For localized
38 // bundles, this overrides the bundle's file name.
39 extern NSString
* const kCFBundleDisplayNameKey
;
41 // The key specifying whether the display name should be localized. This makes
42 // Finder look in localization folders in the app bundle for a display name.
43 // (e.g. Content/Resources/en.lproj/)
44 extern NSString
* const kLSHasLocalizedDisplayNameKey
;
46 // The key under which the browser's bundle ID will be stored in the
47 // app mode launcher bundle's Info.plist.
48 extern NSString
* const kBrowserBundleIDKey
;
50 // Key for the shortcut ID.
51 extern NSString
* const kCrAppModeShortcutIDKey
;
53 // Key for the app's name.
54 extern NSString
* const kCrAppModeShortcutNameKey
;
56 // Key for the app's URL.
57 extern NSString
* const kCrAppModeShortcutURLKey
;
59 // Key for the app user data directory.
60 extern NSString
* const kCrAppModeUserDataDirKey
;
62 // Key for the app's extension path.
63 extern NSString
* const kCrAppModeProfileDirKey
;
65 // Key for the app's profile display name.
66 extern NSString
* const kCrAppModeProfileNameKey
;
68 // When the Chrome browser is run, it stores its location in the defaults
69 // system using this key.
70 extern NSString
* const kLastRunAppBundlePathPrefsKey
;
72 // Placeholders used in the app mode loader bundle' Info.plist:
73 extern NSString
* const kShortcutIdPlaceholder
; // Extension shortcut ID.
74 extern NSString
* const kShortcutNamePlaceholder
; // Extension name.
75 extern NSString
* const kShortcutURLPlaceholder
;
76 // Bundle ID of the Chrome browser bundle.
77 extern NSString
* const kShortcutBrowserBundleIDPlaceholder
;
79 // Current major/minor version numbers of |ChromeAppModeInfo| (defined below).
80 const unsigned kCurrentChromeAppModeInfoMajorVersion
= 1;
81 const unsigned kCurrentChromeAppModeInfoMinorVersion
= 0;
83 // The structure used to pass information from the app mode loader to the
84 // (browser) framework. This is versioned using major and minor version numbers,
85 // written below as v<major>.<minor>. Version-number checking is done by the
86 // framework, and the framework must accept all structures with the same major
87 // version number. It may refuse to load if the major version of the structure
88 // is different from the one it accepts.
89 struct ChromeAppModeInfo
{
94 // Major and minor version number of this structure.
95 unsigned major_version
; // Required: all versions
96 unsigned minor_version
; // Required: all versions
98 // Original |argc| and |argv|.
99 int argc
; // Required: v1.0
100 char** argv
; // Required: v1.0
102 // Versioned path to the browser which is being loaded.
103 base::FilePath chrome_versioned_path
; // Required: v1.0
105 // Path to Chrome app bundle.
106 base::FilePath chrome_outer_bundle_path
; // Required: v1.0
108 // Information about the App Mode shortcut:
110 // Path to the App Mode Loader application bundle that launched the process.
111 base::FilePath app_mode_bundle_path
; // Optional: v1.0
113 // Short ID string, preferably derived from |app_mode_short_name|. Should be
114 // safe for the file system.
115 std::string app_mode_id
; // Required: v1.0
117 // Unrestricted (e.g., several-word) UTF8-encoded name for the shortcut.
118 base::string16 app_mode_name
; // Optional: v1.0
120 // URL for the shortcut. Must be a valid URL.
121 std::string app_mode_url
; // Required: v1.0
123 // Path to the app's user data directory.
124 base::FilePath user_data_dir
;
126 // Directory of the profile associated with the app.
127 base::FilePath profile_dir
;
130 } // namespace app_mode
132 #endif // CHROME_COMMON_MAC_APP_MODE_COMMON_H_