google_chrome_sxs_distribution.cc revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
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
13#include "installer_util_strings.h"  // NOLINT
14
15namespace {
16
17const wchar_t kChromeSxSGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}";
18const wchar_t kChannelName[] = L"canary";
19const wchar_t kBrowserAppId[] = L"ChromeCanary";
20const wchar_t kBrowserProgIdPrefix[] = L"ChromeSSHTM";
21const wchar_t kBrowserProgIdDesc[] = L"Chrome Canary HTML Document";
22const wchar_t kCommandExecuteImplUuid[] =
23    L"{1BEAC3E3-B852-44F4-B468-8906C062422E}";
24
25}  // namespace
26
27GoogleChromeSxSDistribution::GoogleChromeSxSDistribution()
28    : GoogleChromeDistribution() {
29  GoogleChromeDistribution::set_product_guid(kChromeSxSGuid);
30}
31
32base::string16 GoogleChromeSxSDistribution::GetBaseAppName() {
33  return L"Google Chrome Canary";
34}
35
36base::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);
50  }
51}
52
53base::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);
62  }
63}
64
65base::string16 GoogleChromeSxSDistribution::GetBaseAppId() {
66  return kBrowserAppId;
67}
68
69base::string16 GoogleChromeSxSDistribution::GetBrowserProgIdPrefix() {
70  return kBrowserProgIdPrefix;
71}
72
73base::string16 GoogleChromeSxSDistribution::GetBrowserProgIdDesc() {
74  return kBrowserProgIdDesc;
75}
76
77base::string16 GoogleChromeSxSDistribution::GetInstallSubDir() {
78  return GoogleChromeDistribution::GetInstallSubDir().append(
79      installer::kSxSSuffix);
80}
81
82base::string16 GoogleChromeSxSDistribution::GetUninstallRegPath() {
83  return GoogleChromeDistribution::GetUninstallRegPath().append(
84      installer::kSxSSuffix);
85}
86
87BrowserDistribution::DefaultBrowserControlPolicy
88    GoogleChromeSxSDistribution::GetDefaultBrowserControlPolicy() {
89  return DEFAULT_BROWSER_OS_CONTROL_ONLY;
90}
91
92int 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;
98}
99
100bool GoogleChromeSxSDistribution::GetChromeChannel(base::string16* channel) {
101  *channel = kChannelName;
102  return true;
103}
104
105bool GoogleChromeSxSDistribution::GetCommandExecuteImplClsid(
106    base::string16* handler_class_uuid) {
107  if (handler_class_uuid)
108    *handler_class_uuid = kCommandExecuteImplUuid;
109  return true;
110}
111
112bool GoogleChromeSxSDistribution::AppHostIsSupported() {
113  return false;
114}
115
116bool GoogleChromeSxSDistribution::ShouldSetExperimentLabels() {
117  return true;
118}
119
120bool GoogleChromeSxSDistribution::HasUserExperiments() {
121  return true;
122}
123
124base::string16 GoogleChromeSxSDistribution::ChannelName() {
125  return kChannelName;
126}
127