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