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/strings/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 #include "chrome/installer/util/updating_app_registration_data.h" 21 22 #include "installer_util_strings.h" // NOLINT 23 24 ChromeAppHostDistribution::ChromeAppHostDistribution() 25 : BrowserDistribution( 26 CHROME_APP_HOST, 27 scoped_ptr<AppRegistrationData>( 28 new UpdatingAppRegistrationData(installer::kAppLauncherGuid))) { 29 } 30 31 base::string16 ChromeAppHostDistribution::GetBaseAppName() { 32 return L"Google Chrome App Launcher"; 33 } 34 35 base::string16 ChromeAppHostDistribution::GetBrowserProgIdPrefix() { 36 NOTREACHED(); 37 return base::string16(); 38 } 39 40 base::string16 ChromeAppHostDistribution::GetBrowserProgIdDesc() { 41 NOTREACHED(); 42 return base::string16(); 43 } 44 45 base::string16 ChromeAppHostDistribution::GetDisplayName() { 46 return GetShortcutName(SHORTCUT_APP_LAUNCHER); 47 } 48 49 base::string16 ChromeAppHostDistribution::GetShortcutName( 50 ShortcutType shortcut_type) { 51 DCHECK_EQ(shortcut_type, SHORTCUT_APP_LAUNCHER); 52 return installer::GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE); 53 } 54 55 base::string16 ChromeAppHostDistribution::GetBaseAppId() { 56 // Should be same as AppListController::GetAppModelId(). 57 return L"ChromeAppList"; 58 } 59 60 base::string16 ChromeAppHostDistribution::GetInstallSubDir() { 61 return BrowserDistribution::GetSpecificDistribution( 62 BrowserDistribution::CHROME_BINARIES)->GetInstallSubDir(); 63 } 64 65 base::string16 ChromeAppHostDistribution::GetPublisherName() { 66 const base::string16& publisher_name = 67 installer::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE); 68 return publisher_name; 69 } 70 71 base::string16 ChromeAppHostDistribution::GetAppDescription() { 72 const base::string16& app_description = 73 installer::GetLocalizedString(IDS_APP_LAUNCHER_SHORTCUT_TOOLTIP_BASE); 74 return app_description; 75 } 76 77 base::string16 ChromeAppHostDistribution::GetLongAppDescription() { 78 const base::string16& app_description = 79 installer::GetLocalizedString(IDS_APP_LAUNCHER_PRODUCT_DESCRIPTION_BASE); 80 return app_description; 81 } 82 83 std::string ChromeAppHostDistribution::GetSafeBrowsingName() { 84 return "googlechromeapphost"; 85 } 86 87 std::string ChromeAppHostDistribution::GetNetworkStatsServer() const { 88 return chrome_common_net::kEchoTestServerLocation; 89 } 90 91 base::string16 ChromeAppHostDistribution::GetUninstallLinkName() { 92 const base::string16& link_name = 93 installer::GetLocalizedString(IDS_UNINSTALL_APP_LAUNCHER_BASE); 94 return link_name; 95 } 96 97 base::string16 ChromeAppHostDistribution::GetUninstallRegPath() { 98 return L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" 99 L"Google Chrome App Launcher"; 100 } 101 102 BrowserDistribution::DefaultBrowserControlPolicy 103 ChromeAppHostDistribution::GetDefaultBrowserControlPolicy() { 104 return DEFAULT_BROWSER_UNSUPPORTED; 105 } 106 107 bool ChromeAppHostDistribution::CanCreateDesktopShortcuts() { 108 return true; 109 } 110 111 base::string16 ChromeAppHostDistribution::GetIconFilename() { 112 return installer::kChromeAppHostExe; 113 } 114 115 bool ChromeAppHostDistribution::GetCommandExecuteImplClsid( 116 base::string16* handler_class_uuid) { 117 return false; 118 } 119 120 void ChromeAppHostDistribution::UpdateInstallStatus(bool system_install, 121 installer::ArchiveType archive_type, 122 installer::InstallStatus install_status) { 123 #if defined(GOOGLE_CHROME_BUILD) 124 GoogleUpdateSettings::UpdateInstallStatus( 125 system_install, 126 archive_type, 127 InstallUtil::GetInstallReturnCode(install_status), 128 installer::kAppLauncherGuid); 129 #endif 130 } 131