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 // This file defines implementation of GoogleChromeSxSDistribution. 6 7 #include "chrome/installer/util/google_chrome_sxs_distribution.h" 8 9 #include "base/command_line.h" 10 #include "base/logging.h" 11 12 #include "installer_util_strings.h" // NOLINT 13 14 namespace { 15 16 const wchar_t kChromeSxSGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}"; 17 const wchar_t kChannelName[] = L"canary"; 18 const wchar_t kBrowserAppId[] = L"ChromeCanary"; 19 const wchar_t kBrowserProgIdPrefix[] = L"ChromeSSHTM"; 20 const wchar_t kBrowserProgIdDesc[] = L"Chrome Canary HTML Document"; 21 const int kSxSIconIndex = 4; 22 const wchar_t kCommandExecuteImplUuid[] = 23 L"{1BEAC3E3-B852-44F4-B468-8906C062422E}"; 24 25 // The Chrome App Launcher Canary icon is index 6; see chrome_exe.rc. 26 const int kSxSAppLauncherIconIndex = 6; 27 28 } // namespace 29 30 GoogleChromeSxSDistribution::GoogleChromeSxSDistribution() 31 : GoogleChromeDistribution() { 32 GoogleChromeDistribution::set_product_guid(kChromeSxSGuid); 33 } 34 35 string16 GoogleChromeSxSDistribution::GetBaseAppName() { 36 return L"Google Chrome Canary"; 37 } 38 39 string16 GoogleChromeSxSDistribution::GetShortcutName( 40 ShortcutType shortcut_type) { 41 switch (shortcut_type) { 42 case SHORTCUT_CHROME_ALTERNATE: 43 // This should never be called. Returning the same string as Google Chrome 44 // preserves behavior, but it will result in a naming collision. 45 NOTREACHED(); 46 return GoogleChromeDistribution::GetShortcutName(shortcut_type); 47 case SHORTCUT_APP_LAUNCHER: 48 return installer::GetLocalizedString( 49 IDS_APP_LIST_SHORTCUT_NAME_CANARY_BASE); 50 default: 51 DCHECK_EQ(shortcut_type, SHORTCUT_CHROME); 52 return installer::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE); 53 } 54 } 55 56 string16 GoogleChromeSxSDistribution::GetStartMenuShortcutSubfolder( 57 Subfolder subfolder_type) { 58 switch (subfolder_type) { 59 case SUBFOLDER_APPS: 60 return installer::GetLocalizedString( 61 IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY_BASE); 62 default: 63 DCHECK_EQ(subfolder_type, SUBFOLDER_CHROME); 64 return GetShortcutName(SHORTCUT_CHROME); 65 } 66 } 67 68 string16 GoogleChromeSxSDistribution::GetBaseAppId() { 69 return kBrowserAppId; 70 } 71 72 string16 GoogleChromeSxSDistribution::GetBrowserProgIdPrefix() { 73 return kBrowserProgIdPrefix; 74 } 75 76 string16 GoogleChromeSxSDistribution::GetBrowserProgIdDesc() { 77 return kBrowserProgIdDesc; 78 } 79 80 string16 GoogleChromeSxSDistribution::GetInstallSubDir() { 81 return GoogleChromeDistribution::GetInstallSubDir().append( 82 installer::kSxSSuffix); 83 } 84 85 string16 GoogleChromeSxSDistribution::GetUninstallRegPath() { 86 return GoogleChromeDistribution::GetUninstallRegPath().append( 87 installer::kSxSSuffix); 88 } 89 90 BrowserDistribution::DefaultBrowserControlPolicy 91 GoogleChromeSxSDistribution::GetDefaultBrowserControlPolicy() { 92 return DEFAULT_BROWSER_OS_CONTROL_ONLY; 93 } 94 95 int GoogleChromeSxSDistribution::GetIconIndex(ShortcutType shortcut_type) { 96 if (shortcut_type == SHORTCUT_APP_LAUNCHER) 97 return kSxSAppLauncherIconIndex; 98 DCHECK(shortcut_type == SHORTCUT_CHROME || 99 shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type; 100 return kSxSIconIndex; 101 } 102 103 bool GoogleChromeSxSDistribution::GetChromeChannel(string16* channel) { 104 *channel = kChannelName; 105 return true; 106 } 107 108 bool GoogleChromeSxSDistribution::GetCommandExecuteImplClsid( 109 string16* handler_class_uuid) { 110 if (handler_class_uuid) 111 *handler_class_uuid = kCommandExecuteImplUuid; 112 return true; 113 } 114 115 bool GoogleChromeSxSDistribution::AppHostIsSupported() { 116 return false; 117 } 118 119 bool GoogleChromeSxSDistribution::ShouldSetExperimentLabels() { 120 return true; 121 } 122 123 bool GoogleChromeSxSDistribution::HasUserExperiments() { 124 return true; 125 } 126 127 string16 GoogleChromeSxSDistribution::ChannelName() { 128 return kChannelName; 129 } 130