chrome_app_host_distribution.cc revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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 a specific implementation of BrowserDistribution class for
6// Chrome App Host. It overrides the bare minimum of methods necessary to get a
7// Chrome App Host installer that does not interact with Google Chrome or
8// Chromium installations.
9
10#include "chrome/installer/util/chrome_app_host_distribution.h"
11
12#include "base/string_util.h"
13#include "chrome/common/net/test_server_locations.h"
14#include "chrome/installer/util/channel_info.h"
15#include "chrome/installer/util/google_update_constants.h"
16#include "chrome/installer/util/google_update_settings.h"
17#include "chrome/installer/util/helper.h"
18#include "chrome/installer/util/install_util.h"
19#include "chrome/installer/util/l10n_string_util.h"
20
21#include "installer_util_strings.h"  // NOLINT
22
23namespace {
24
25const wchar_t kChromeAppHostGuid[] = L"{FDA71E6F-AC4C-4a00-8B70-9958A68906BF}";
26
27}  // namespace
28
29ChromeAppHostDistribution::ChromeAppHostDistribution()
30    : BrowserDistribution(CHROME_APP_HOST) {
31}
32
33string16 ChromeAppHostDistribution::GetAppGuid() {
34  return kChromeAppHostGuid;
35}
36
37string16 ChromeAppHostDistribution::GetBaseAppName() {
38  return L"Google Chrome App Launcher";
39}
40
41string16 ChromeAppHostDistribution::GetAppShortCutName() {
42  const string16& product_name =
43      installer::GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE);
44  return product_name;
45}
46
47string16 ChromeAppHostDistribution::GetAlternateApplicationName() {
48  const string16& product_name =
49      installer::GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE);
50  return product_name;
51}
52
53string16 ChromeAppHostDistribution::GetBaseAppId() {
54  // Should be same as AppListController::GetAppModelId().
55  return L"ChromeAppList";
56}
57
58string16 ChromeAppHostDistribution::GetInstallSubDir() {
59  return BrowserDistribution::GetSpecificDistribution(
60      BrowserDistribution::CHROME_BINARIES)->GetInstallSubDir();
61}
62
63string16 ChromeAppHostDistribution::GetPublisherName() {
64  const string16& publisher_name =
65      installer::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE);
66  return publisher_name;
67}
68
69string16 ChromeAppHostDistribution::GetAppDescription() {
70  const string16& app_description =
71      installer::GetLocalizedString(IDS_APP_LAUNCHER_SHORTCUT_TOOLTIP_BASE);
72  return app_description;
73}
74
75string16 ChromeAppHostDistribution::GetLongAppDescription() {
76  const string16& app_description =
77      installer::GetLocalizedString(IDS_APP_LAUNCHER_PRODUCT_DESCRIPTION_BASE);
78  return app_description;
79}
80
81std::string ChromeAppHostDistribution::GetSafeBrowsingName() {
82  return "googlechromeapphost";
83}
84
85string16 ChromeAppHostDistribution::GetStateKey() {
86  string16 key(google_update::kRegPathClientState);
87  key.append(L"\\");
88  key.append(kChromeAppHostGuid);
89  return key;
90}
91
92string16 ChromeAppHostDistribution::GetStateMediumKey() {
93  string16 key(google_update::kRegPathClientStateMedium);
94  key.append(L"\\");
95  key.append(kChromeAppHostGuid);
96  return key;
97}
98
99string16 ChromeAppHostDistribution::GetStatsServerURL() {
100  return L"https://clients4.google.com/firefox/metrics/collect";
101}
102
103std::string ChromeAppHostDistribution::GetNetworkStatsServer() const {
104  return chrome_common_net::kEchoTestServerLocation;
105}
106
107std::string ChromeAppHostDistribution::GetHttpPipeliningTestServer() const {
108  return chrome_common_net::kPipelineTestServerBaseUrl;
109}
110
111string16 ChromeAppHostDistribution::GetUninstallLinkName() {
112  const string16& link_name =
113      installer::GetLocalizedString(IDS_UNINSTALL_APP_LAUNCHER_BASE);
114  return link_name;
115}
116
117string16 ChromeAppHostDistribution::GetUninstallRegPath() {
118  return L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
119         L"Google Chrome App Launcher";
120}
121
122string16 ChromeAppHostDistribution::GetVersionKey() {
123  string16 key(google_update::kRegPathClients);
124  key.append(L"\\");
125  key.append(kChromeAppHostGuid);
126  return key;
127}
128
129bool ChromeAppHostDistribution::CanSetAsDefault() {
130  return false;
131}
132
133bool ChromeAppHostDistribution::CanCreateDesktopShortcuts() {
134  return true;
135}
136
137string16 ChromeAppHostDistribution::GetIconFilename() {
138  return installer::kChromeAppHostExe;
139}
140
141bool ChromeAppHostDistribution::GetCommandExecuteImplClsid(
142    string16* handler_class_uuid) {
143  return false;
144}
145
146void ChromeAppHostDistribution::UpdateInstallStatus(bool system_install,
147    installer::ArchiveType archive_type,
148    installer::InstallStatus install_status) {
149#if defined(GOOGLE_CHROME_BUILD)
150  GoogleUpdateSettings::UpdateInstallStatus(system_install,
151      archive_type, InstallUtil::GetInstallReturnCode(install_status),
152      kChromeAppHostGuid);
153#endif
154}
155