chrome_app_host_distribution.cc revision 5821806d5e7f356e8fa4b058a389a808ea183019
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 25#if defined(GOOGLE_CHROME_BUILD) 26const int kAppListIconIndex = 5; 27#else 28const int kAppListIconIndex = 1; 29#endif 30const wchar_t kChromeAppHostGuid[] = L"{FDA71E6F-AC4C-4a00-8B70-9958A68906BF}"; 31 32} // namespace 33 34ChromeAppHostDistribution::ChromeAppHostDistribution() 35 : BrowserDistribution(CHROME_APP_HOST) { 36} 37 38string16 ChromeAppHostDistribution::GetAppGuid() { 39 return kChromeAppHostGuid; 40} 41 42string16 ChromeAppHostDistribution::GetBaseAppName() { 43 return L"Google Chrome App Host"; 44} 45 46string16 ChromeAppHostDistribution::GetAppShortCutName() { 47 const string16& product_name = 48 installer::GetLocalizedString(IDS_PRODUCT_APP_HOST_NAME_BASE); 49 return product_name; 50} 51 52string16 ChromeAppHostDistribution::GetAlternateApplicationName() { 53 const string16& product_name = 54 installer::GetLocalizedString(IDS_PRODUCT_APP_HOST_NAME_BASE); 55 return product_name; 56} 57 58string16 ChromeAppHostDistribution::GetBaseAppId() { 59 // Should be same as AppListController::GetAppModelId(). 60 return L"ChromeAppList"; 61} 62 63string16 ChromeAppHostDistribution::GetInstallSubDir() { 64 return BrowserDistribution::GetSpecificDistribution( 65 BrowserDistribution::CHROME_BINARIES)->GetInstallSubDir(); 66} 67 68string16 ChromeAppHostDistribution::GetPublisherName() { 69 const string16& publisher_name = 70 installer::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE); 71 return publisher_name; 72} 73 74string16 ChromeAppHostDistribution::GetAppDescription() { 75 const string16& app_description = 76 installer::GetLocalizedString(IDS_APP_LAUNCHER_SHORTCUT_TOOLTIP_BASE); 77 return app_description; 78} 79 80string16 ChromeAppHostDistribution::GetLongAppDescription() { 81 const string16& app_description = 82 installer::GetLocalizedString(IDS_APP_LAUNCHER_PRODUCT_DESCRIPTION_BASE); 83 return app_description; 84} 85 86std::string ChromeAppHostDistribution::GetSafeBrowsingName() { 87 return "googlechromeapphost"; 88} 89 90string16 ChromeAppHostDistribution::GetStateKey() { 91 string16 key(google_update::kRegPathClientState); 92 key.append(L"\\"); 93 key.append(kChromeAppHostGuid); 94 return key; 95} 96 97string16 ChromeAppHostDistribution::GetStateMediumKey() { 98 string16 key(google_update::kRegPathClientStateMedium); 99 key.append(L"\\"); 100 key.append(kChromeAppHostGuid); 101 return key; 102} 103 104string16 ChromeAppHostDistribution::GetStatsServerURL() { 105 return L"https://clients4.google.com/firefox/metrics/collect"; 106} 107 108std::string ChromeAppHostDistribution::GetNetworkStatsServer() const { 109 return chrome_common_net::kEchoTestServerLocation; 110} 111 112std::string ChromeAppHostDistribution::GetHttpPipeliningTestServer() const { 113 return chrome_common_net::kPipelineTestServerBaseUrl; 114} 115 116string16 ChromeAppHostDistribution::GetUninstallLinkName() { 117 const string16& link_name = 118 installer::GetLocalizedString(IDS_UNINSTALL_APP_LAUNCHER_BASE); 119 return link_name; 120} 121 122string16 ChromeAppHostDistribution::GetUninstallRegPath() { 123 return L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" 124 L"Google Chrome App Host"; 125} 126 127string16 ChromeAppHostDistribution::GetVersionKey() { 128 string16 key(google_update::kRegPathClients); 129 key.append(L"\\"); 130 key.append(kChromeAppHostGuid); 131 return key; 132} 133 134bool ChromeAppHostDistribution::CanSetAsDefault() { 135 return false; 136} 137 138bool ChromeAppHostDistribution::CanCreateDesktopShortcuts() { 139 return true; 140} 141 142int ChromeAppHostDistribution::GetIconIndex() { 143 return kAppListIconIndex; 144} 145 146bool ChromeAppHostDistribution::GetCommandExecuteImplClsid( 147 string16* handler_class_uuid) { 148 return false; 149} 150 151void ChromeAppHostDistribution::UpdateInstallStatus(bool system_install, 152 installer::ArchiveType archive_type, 153 installer::InstallStatus install_status) { 154#if defined(GOOGLE_CHROME_BUILD) 155 GoogleUpdateSettings::UpdateInstallStatus(system_install, 156 archive_type, InstallUtil::GetInstallReturnCode(install_status), 157 kChromeAppHostGuid); 158#endif 159} 160