Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / installer / util / google_chrome_sxs_distribution.cc
blob57914f34b61899688978ae14b4a4525a58856c20
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.
7 #include "chrome/installer/util/google_chrome_sxs_distribution.h"
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/installer_util_strings.h"
13 #include "chrome/installer/util/updating_app_registration_data.h"
15 namespace {
17 const wchar_t kChromeSxSGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}";
18 const wchar_t kChannelName[] = L"canary";
19 const wchar_t kBrowserAppId[] = L"ChromeCanary";
20 const wchar_t kBrowserProgIdPrefix[] = L"ChromeSSHTM";
21 const wchar_t kBrowserProgIdDesc[] = L"Chrome Canary HTML Document";
22 const wchar_t kCommandExecuteImplUuid[] =
23 L"{1BEAC3E3-B852-44F4-B468-8906C062422E}";
25 } // namespace
27 GoogleChromeSxSDistribution::GoogleChromeSxSDistribution()
28 : GoogleChromeDistribution(scoped_ptr<AppRegistrationData>(
29 new UpdatingAppRegistrationData(kChromeSxSGuid))) {
32 base::string16 GoogleChromeSxSDistribution::GetBaseAppName() {
33 return L"Google Chrome Canary";
36 base::string16 GoogleChromeSxSDistribution::GetShortcutName(
37 ShortcutType shortcut_type) {
38 switch (shortcut_type) {
39 case SHORTCUT_CHROME_ALTERNATE:
40 // This should never be called. Returning the same string as Google Chrome
41 // preserves behavior, but it will result in a naming collision.
42 NOTREACHED();
43 return GoogleChromeDistribution::GetShortcutName(shortcut_type);
44 case SHORTCUT_APP_LAUNCHER:
45 return installer::GetLocalizedString(
46 IDS_APP_LIST_SHORTCUT_NAME_CANARY_BASE);
47 default:
48 DCHECK_EQ(shortcut_type, SHORTCUT_CHROME);
49 return installer::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE);
53 base::string16 GoogleChromeSxSDistribution::GetStartMenuShortcutSubfolder(
54 Subfolder subfolder_type) {
55 switch (subfolder_type) {
56 case SUBFOLDER_APPS:
57 return installer::GetLocalizedString(
58 IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY_BASE);
59 default:
60 DCHECK_EQ(subfolder_type, SUBFOLDER_CHROME);
61 return GetShortcutName(SHORTCUT_CHROME);
65 base::string16 GoogleChromeSxSDistribution::GetBaseAppId() {
66 return kBrowserAppId;
69 base::string16 GoogleChromeSxSDistribution::GetBrowserProgIdPrefix() {
70 return kBrowserProgIdPrefix;
73 base::string16 GoogleChromeSxSDistribution::GetBrowserProgIdDesc() {
74 return kBrowserProgIdDesc;
77 base::string16 GoogleChromeSxSDistribution::GetInstallSubDir() {
78 return GoogleChromeDistribution::GetInstallSubDir().append(
79 installer::kSxSSuffix);
82 base::string16 GoogleChromeSxSDistribution::GetUninstallRegPath() {
83 return GoogleChromeDistribution::GetUninstallRegPath().append(
84 installer::kSxSSuffix);
87 BrowserDistribution::DefaultBrowserControlPolicy
88 GoogleChromeSxSDistribution::GetDefaultBrowserControlPolicy() {
89 return DEFAULT_BROWSER_OS_CONTROL_ONLY;
92 int GoogleChromeSxSDistribution::GetIconIndex(ShortcutType shortcut_type) {
93 if (shortcut_type == SHORTCUT_APP_LAUNCHER)
94 return icon_resources::kSxSAppLauncherIndex;
95 DCHECK(shortcut_type == SHORTCUT_CHROME ||
96 shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type;
97 return icon_resources::kSxSApplicationIndex;
100 bool GoogleChromeSxSDistribution::GetChromeChannel(base::string16* channel) {
101 *channel = kChannelName;
102 return true;
105 base::string16 GoogleChromeSxSDistribution::GetCommandExecuteImplClsid() {
106 return kCommandExecuteImplUuid;
109 bool GoogleChromeSxSDistribution::ShouldSetExperimentLabels() {
110 return true;
113 bool GoogleChromeSxSDistribution::HasUserExperiments() {
114 return true;
117 base::string16 GoogleChromeSxSDistribution::ChannelName() {
118 return kChannelName;