Do not announce robot account token before account ID is available
[chromium-blink-merge.git] / chrome / installer / util / google_chrome_sxs_distribution.cc
blobf4a3c3b0cfd38c47246f35d07becd07a8aeb578e
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/updating_app_registration_data.h"
14 #include "installer_util_strings.h" // NOLINT
16 namespace {
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}";
26 } // namespace
28 GoogleChromeSxSDistribution::GoogleChromeSxSDistribution()
29 : GoogleChromeDistribution(scoped_ptr<AppRegistrationData>(
30 new UpdatingAppRegistrationData(kChromeSxSGuid))) {
33 base::string16 GoogleChromeSxSDistribution::GetBaseAppName() {
34 return L"Google Chrome Canary";
37 base::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);
54 base::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);
66 base::string16 GoogleChromeSxSDistribution::GetBaseAppId() {
67 return kBrowserAppId;
70 base::string16 GoogleChromeSxSDistribution::GetBrowserProgIdPrefix() {
71 return kBrowserProgIdPrefix;
74 base::string16 GoogleChromeSxSDistribution::GetBrowserProgIdDesc() {
75 return kBrowserProgIdDesc;
78 base::string16 GoogleChromeSxSDistribution::GetInstallSubDir() {
79 return GoogleChromeDistribution::GetInstallSubDir().append(
80 installer::kSxSSuffix);
83 base::string16 GoogleChromeSxSDistribution::GetUninstallRegPath() {
84 return GoogleChromeDistribution::GetUninstallRegPath().append(
85 installer::kSxSSuffix);
88 BrowserDistribution::DefaultBrowserControlPolicy
89 GoogleChromeSxSDistribution::GetDefaultBrowserControlPolicy() {
90 return DEFAULT_BROWSER_OS_CONTROL_ONLY;
93 int 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;
101 bool GoogleChromeSxSDistribution::GetChromeChannel(base::string16* channel) {
102 *channel = kChannelName;
103 return true;
106 bool GoogleChromeSxSDistribution::GetCommandExecuteImplClsid(
107 base::string16* handler_class_uuid) {
108 if (handler_class_uuid)
109 *handler_class_uuid = kCommandExecuteImplUuid;
110 return true;
113 bool GoogleChromeSxSDistribution::ShouldSetExperimentLabels() {
114 return true;
117 bool GoogleChromeSxSDistribution::HasUserExperiments() {
118 return true;
121 base::string16 GoogleChromeSxSDistribution::ChannelName() {
122 return kChannelName;