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