google_chrome_sxs_distribution.cc revision 3551c9c881056c480085172ff9840cab31610854
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
12#include "installer_util_strings.h"  // NOLINT
13
14namespace {
15
16const wchar_t kChromeSxSGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}";
17const wchar_t kChannelName[] = L"canary";
18const wchar_t kBrowserAppId[] = L"ChromeCanary";
19const int kSxSIconIndex = 4;
20
21// The Chrome App Launcher Canary icon is index 6; see chrome_exe.rc.
22const int kSxSAppLauncherIconIndex = 6;
23
24}  // namespace
25
26GoogleChromeSxSDistribution::GoogleChromeSxSDistribution()
27    : GoogleChromeDistribution() {
28  GoogleChromeDistribution::set_product_guid(kChromeSxSGuid);
29}
30
31string16 GoogleChromeSxSDistribution::GetBaseAppName() {
32  return L"Google Chrome Canary";
33}
34
35string16 GoogleChromeSxSDistribution::GetShortcutName(
36    ShortcutType shortcut_type) {
37  switch (shortcut_type) {
38    case SHORTCUT_CHROME_ALTERNATE:
39      // This should never be called. Returning the same string as Google Chrome
40      // preserves behavior, but it will result in a naming collision.
41      NOTREACHED();
42      return GoogleChromeDistribution::GetShortcutName(shortcut_type);
43    case SHORTCUT_APP_LAUNCHER:
44      return installer::GetLocalizedString(
45          IDS_APP_LIST_SHORTCUT_NAME_CANARY_BASE);
46    default:
47      DCHECK_EQ(shortcut_type, SHORTCUT_CHROME);
48      return installer::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE);
49  }
50}
51
52string16 GoogleChromeSxSDistribution::GetBaseAppId() {
53  return kBrowserAppId;
54}
55
56string16 GoogleChromeSxSDistribution::GetInstallSubDir() {
57  return GoogleChromeDistribution::GetInstallSubDir().append(
58      installer::kSxSSuffix);
59}
60
61string16 GoogleChromeSxSDistribution::GetUninstallRegPath() {
62  return GoogleChromeDistribution::GetUninstallRegPath().append(
63      installer::kSxSSuffix);
64}
65
66bool GoogleChromeSxSDistribution::CanSetAsDefault() {
67  return false;
68}
69
70int GoogleChromeSxSDistribution::GetIconIndex(ShortcutType shortcut_type) {
71  if (shortcut_type == SHORTCUT_APP_LAUNCHER)
72    return kSxSAppLauncherIconIndex;
73  DCHECK(shortcut_type == SHORTCUT_CHROME ||
74         shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type;
75  return kSxSIconIndex;
76}
77
78bool GoogleChromeSxSDistribution::GetChromeChannel(string16* channel) {
79  *channel = kChannelName;
80  return true;
81}
82
83bool GoogleChromeSxSDistribution::GetCommandExecuteImplClsid(
84    string16* handler_class_uuid) {
85  return false;
86}
87
88bool GoogleChromeSxSDistribution::AppHostIsSupported() {
89  return false;
90}
91
92bool GoogleChromeSxSDistribution::ShouldSetExperimentLabels() {
93  return true;
94}
95
96bool GoogleChromeSxSDistribution::HasUserExperiments() {
97  return true;
98}
99
100string16 GoogleChromeSxSDistribution::ChannelName() {
101  return kChannelName;
102}
103