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.
5 // This file defines implementation of GoogleChromeSxSDistribution.
7 #include "chrome/installer/util/google_chrome_sxs_distribution.h"
9 #include "base/command_line.h"
10 #include "base/logging.h"
12 #include "installer_util_strings.h" // NOLINT
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}";
25 // The Chrome App Launcher Canary icon is index 6; see chrome_exe.rc.
26 const int kSxSAppLauncherIconIndex
= 6;
30 GoogleChromeSxSDistribution::GoogleChromeSxSDistribution()
31 : GoogleChromeDistribution() {
32 GoogleChromeDistribution::set_product_guid(kChromeSxSGuid
);
35 base::string16
GoogleChromeSxSDistribution::GetBaseAppName() {
36 return L
"Google Chrome Canary";
39 base::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.
46 return GoogleChromeDistribution::GetShortcutName(shortcut_type
);
47 case SHORTCUT_APP_LAUNCHER
:
48 return installer::GetLocalizedString(
49 IDS_APP_LIST_SHORTCUT_NAME_CANARY_BASE
);
51 DCHECK_EQ(shortcut_type
, SHORTCUT_CHROME
);
52 return installer::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE
);
56 base::string16
GoogleChromeSxSDistribution::GetStartMenuShortcutSubfolder(
57 Subfolder subfolder_type
) {
58 switch (subfolder_type
) {
60 return installer::GetLocalizedString(
61 IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY_BASE
);
63 DCHECK_EQ(subfolder_type
, SUBFOLDER_CHROME
);
64 return GetShortcutName(SHORTCUT_CHROME
);
68 base::string16
GoogleChromeSxSDistribution::GetBaseAppId() {
72 base::string16
GoogleChromeSxSDistribution::GetBrowserProgIdPrefix() {
73 return kBrowserProgIdPrefix
;
76 base::string16
GoogleChromeSxSDistribution::GetBrowserProgIdDesc() {
77 return kBrowserProgIdDesc
;
80 base::string16
GoogleChromeSxSDistribution::GetInstallSubDir() {
81 return GoogleChromeDistribution::GetInstallSubDir().append(
82 installer::kSxSSuffix
);
85 base::string16
GoogleChromeSxSDistribution::GetUninstallRegPath() {
86 return GoogleChromeDistribution::GetUninstallRegPath().append(
87 installer::kSxSSuffix
);
90 BrowserDistribution::DefaultBrowserControlPolicy
91 GoogleChromeSxSDistribution::GetDefaultBrowserControlPolicy() {
92 return DEFAULT_BROWSER_OS_CONTROL_ONLY
;
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
;
103 bool GoogleChromeSxSDistribution::GetChromeChannel(base::string16
* channel
) {
104 *channel
= kChannelName
;
108 bool GoogleChromeSxSDistribution::GetCommandExecuteImplClsid(
109 base::string16
* handler_class_uuid
) {
110 if (handler_class_uuid
)
111 *handler_class_uuid
= kCommandExecuteImplUuid
;
115 bool GoogleChromeSxSDistribution::AppHostIsSupported() {
119 bool GoogleChromeSxSDistribution::ShouldSetExperimentLabels() {
123 bool GoogleChromeSxSDistribution::HasUserExperiments() {
127 base::string16
GoogleChromeSxSDistribution::ChannelName() {