Home | History | Annotate | Download | only in mac
      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/mac/app_mode_common.h"
      6 
      7 #include "base/files/file_util.h"
      8 
      9 namespace app_mode {
     10 
     11 const char kAppShimSocketShortName[] = "Socket";
     12 const char kAppShimSocketSymlinkName[] = "App Shim Socket";
     13 
     14 const char kRunningChromeVersionSymlinkName[] = "RunningChromeVersion";
     15 
     16 const char kAppListModeId[] = "app_list";
     17 
     18 const char kLaunchedByChromeProcessId[] = "launched-by-chrome-process-id";
     19 const char kLaunchedForTest[] = "launched-for-test";
     20 const char kLaunchedAfterRebuild[] = "launched-after-rebuild";
     21 
     22 const char kAppShimError[] = "app-shim-error";
     23 
     24 NSString* const kCFBundleDocumentTypesKey = @"CFBundleDocumentTypes";
     25 NSString* const kCFBundleTypeExtensionsKey = @"CFBundleTypeExtensions";
     26 NSString* const kCFBundleTypeIconFileKey = @"CFBundleTypeIconFile";
     27 NSString* const kCFBundleTypeNameKey = @"CFBundleTypeName";
     28 NSString* const kCFBundleTypeMIMETypesKey = @"CFBundleTypeMIMETypes";
     29 NSString* const kCFBundleTypeRoleKey = @"CFBundleTypeRole";
     30 NSString* const kBundleTypeRoleViewer = @"Viewer";
     31 
     32 NSString* const kCFBundleDisplayNameKey = @"CFBundleDisplayName";
     33 NSString* const kCFBundleShortVersionStringKey = @"CFBundleShortVersionString";
     34 NSString* const kLSHasLocalizedDisplayNameKey = @"LSHasLocalizedDisplayName";
     35 NSString* const kBrowserBundleIDKey = @"CrBundleIdentifier";
     36 NSString* const kCrAppModeShortcutIDKey = @"CrAppModeShortcutID";
     37 NSString* const kCrAppModeShortcutNameKey = @"CrAppModeShortcutName";
     38 NSString* const kCrAppModeShortcutURLKey = @"CrAppModeShortcutURL";
     39 NSString* const kCrAppModeUserDataDirKey = @"CrAppModeUserDataDir";
     40 NSString* const kCrAppModeProfileDirKey = @"CrAppModeProfileDir";
     41 NSString* const kCrAppModeProfileNameKey = @"CrAppModeProfileName";
     42 
     43 NSString* const kLastRunAppBundlePathPrefsKey = @"LastRunAppBundlePath";
     44 
     45 NSString* const kShortcutIdPlaceholder = @"APP_MODE_SHORTCUT_ID";
     46 NSString* const kShortcutNamePlaceholder = @"APP_MODE_SHORTCUT_NAME";
     47 NSString* const kShortcutURLPlaceholder = @"APP_MODE_SHORTCUT_URL";
     48 NSString* const kShortcutBrowserBundleIDPlaceholder =
     49                     @"APP_MODE_BROWSER_BUNDLE_ID";
     50 
     51 ChromeAppModeInfo::ChromeAppModeInfo()
     52     : major_version(0),
     53       minor_version(0),
     54       argc(0),
     55       argv(0) {
     56 }
     57 
     58 ChromeAppModeInfo::~ChromeAppModeInfo() {
     59 }
     60 
     61 void VerifySocketPermissions(const base::FilePath& socket_path) {
     62   CHECK(base::PathIsWritable(socket_path));
     63   base::FilePath socket_dir = socket_path.DirName();
     64   int socket_dir_mode = 0;
     65   CHECK(base::GetPosixFilePermissions(socket_dir, &socket_dir_mode));
     66   CHECK_EQ(0700, socket_dir_mode);
     67 }
     68 
     69 }  // namespace app_mode
     70