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 CHROME_COMMON_MAC_APP_MODE_COMMON_H_ 6#define CHROME_COMMON_MAC_APP_MODE_COMMON_H_ 7 8#import <Foundation/Foundation.h> 9 10#include "base/files/file_path.h" 11#include "base/strings/string16.h" 12 13// This file contains constants, interfaces, etc. which are common to the 14// browser application and the app mode loader (a.k.a. shim). 15 16namespace app_mode { 17 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. 22const AEEventClass kAEChromeAppClass = 'cApp'; 23const AEEventID kAEChromeAppPing = 'ping'; 24 25// The IPC socket used to communicate between app shims and Chrome will be 26// created under the user data directory with this name. 27extern const char kAppShimSocketName[]; 28 29// Special app mode id used for the App Launcher. 30extern const char kAppListModeId[]; 31 32// Instructs the app shim to send LaunchApp with launch_now = false. This 33// associates the shim without launching the app. 34extern const char kNoLaunchApp[]; 35 36// The display name of the bundle as shown in Finder and the Dock. For localized 37// bundles, this overrides the bundle's file name. 38extern NSString* const kCFBundleDisplayNameKey; 39 40// The key specifying whether the display name should be localized. This makes 41// Finder look in localization folders in the app bundle for a display name. 42// (e.g. Content/Resources/en.lproj/) 43extern NSString* const kLSHasLocalizedDisplayNameKey; 44 45// The key under which the browser's bundle ID will be stored in the 46// app mode launcher bundle's Info.plist. 47extern NSString* const kBrowserBundleIDKey; 48 49// Key for the shortcut ID. 50extern NSString* const kCrAppModeShortcutIDKey; 51 52// Key for the app's name. 53extern NSString* const kCrAppModeShortcutNameKey; 54 55// Key for the app's URL. 56extern NSString* const kCrAppModeShortcutURLKey; 57 58// Key for the app user data directory. 59extern NSString* const kCrAppModeUserDataDirKey; 60 61// Key for the app's extension path. 62extern NSString* const kCrAppModeProfileDirKey; 63 64// Key for the app's profile display name. 65extern NSString* const kCrAppModeProfileNameKey; 66 67// When the Chrome browser is run, it stores its location in the defaults 68// system using this key. 69extern NSString* const kLastRunAppBundlePathPrefsKey; 70 71// Placeholders used in the app mode loader bundle' Info.plist: 72extern NSString* const kShortcutIdPlaceholder; // Extension shortcut ID. 73extern NSString* const kShortcutNamePlaceholder; // Extension name. 74extern NSString* const kShortcutURLPlaceholder; 75// Bundle ID of the Chrome browser bundle. 76extern NSString* const kShortcutBrowserBundleIDPlaceholder; 77 78// Current major/minor version numbers of |ChromeAppModeInfo| (defined below). 79const unsigned kCurrentChromeAppModeInfoMajorVersion = 1; 80const unsigned kCurrentChromeAppModeInfoMinorVersion = 0; 81 82// The structure used to pass information from the app mode loader to the 83// (browser) framework. This is versioned using major and minor version numbers, 84// written below as v<major>.<minor>. Version-number checking is done by the 85// framework, and the framework must accept all structures with the same major 86// version number. It may refuse to load if the major version of the structure 87// is different from the one it accepts. 88struct ChromeAppModeInfo { 89 public: 90 ChromeAppModeInfo(); 91 ~ChromeAppModeInfo(); 92 93 // Major and minor version number of this structure. 94 unsigned major_version; // Required: all versions 95 unsigned minor_version; // Required: all versions 96 97 // Original |argc| and |argv|. 98 int argc; // Required: v1.0 99 char** argv; // Required: v1.0 100 101 // Versioned path to the browser which is being loaded. 102 base::FilePath chrome_versioned_path; // Required: v1.0 103 104 // Path to Chrome app bundle. 105 base::FilePath chrome_outer_bundle_path; // Required: v1.0 106 107 // Information about the App Mode shortcut: 108 109 // Path to the App Mode Loader application bundle that launched the process. 110 base::FilePath app_mode_bundle_path; // Optional: v1.0 111 112 // Short ID string, preferably derived from |app_mode_short_name|. Should be 113 // safe for the file system. 114 std::string app_mode_id; // Required: v1.0 115 116 // Unrestricted (e.g., several-word) UTF8-encoded name for the shortcut. 117 string16 app_mode_name; // Optional: v1.0 118 119 // URL for the shortcut. Must be a valid URL. 120 std::string app_mode_url; // Required: v1.0 121 122 // Path to the app's user data directory. 123 base::FilePath user_data_dir; 124 125 // Directory of the profile associated with the app. 126 base::FilePath profile_dir; 127}; 128 129} // namespace app_mode 130 131#endif // CHROME_COMMON_MAC_APP_MODE_COMMON_H_ 132