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