- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / installer / util / chrome_app_host_distribution.cc
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
21 #include "installer_util_strings.h"  // NOLINT
22
23 namespace {
24
25 const wchar_t kChromeAppHostGuid[] = L"{FDA71E6F-AC4C-4a00-8B70-9958A68906BF}";
26
27 }  // namespace
28
29 ChromeAppHostDistribution::ChromeAppHostDistribution()
30     : BrowserDistribution(CHROME_APP_HOST) {
31 }
32
33 string16 ChromeAppHostDistribution::GetAppGuid() {
34   return kChromeAppHostGuid;
35 }
36
37 string16 ChromeAppHostDistribution::GetBaseAppName() {
38   return L"Google Chrome App Launcher";
39 }
40
41 string16 ChromeAppHostDistribution::GetBrowserProgIdPrefix() {
42   NOTREACHED();
43   return string16();
44 }
45
46 string16 ChromeAppHostDistribution::GetBrowserProgIdDesc() {
47   NOTREACHED();
48   return string16();
49 }
50
51 string16 ChromeAppHostDistribution::GetDisplayName() {
52   return GetShortcutName(SHORTCUT_APP_LAUNCHER);
53 }
54
55 string16 ChromeAppHostDistribution::GetShortcutName(
56     ShortcutType shortcut_type) {
57   DCHECK_EQ(shortcut_type, SHORTCUT_APP_LAUNCHER);
58   return installer::GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE);
59 }
60
61 string16 ChromeAppHostDistribution::GetBaseAppId() {
62   // Should be same as AppListController::GetAppModelId().
63   return L"ChromeAppList";
64 }
65
66 string16 ChromeAppHostDistribution::GetInstallSubDir() {
67   return BrowserDistribution::GetSpecificDistribution(
68       BrowserDistribution::CHROME_BINARIES)->GetInstallSubDir();
69 }
70
71 string16 ChromeAppHostDistribution::GetPublisherName() {
72   const string16& publisher_name =
73       installer::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE);
74   return publisher_name;
75 }
76
77 string16 ChromeAppHostDistribution::GetAppDescription() {
78   const string16& app_description =
79       installer::GetLocalizedString(IDS_APP_LAUNCHER_SHORTCUT_TOOLTIP_BASE);
80   return app_description;
81 }
82
83 string16 ChromeAppHostDistribution::GetLongAppDescription() {
84   const string16& app_description =
85       installer::GetLocalizedString(IDS_APP_LAUNCHER_PRODUCT_DESCRIPTION_BASE);
86   return app_description;
87 }
88
89 std::string ChromeAppHostDistribution::GetSafeBrowsingName() {
90   return "googlechromeapphost";
91 }
92
93 string16 ChromeAppHostDistribution::GetStateKey() {
94   string16 key(google_update::kRegPathClientState);
95   key.append(L"\\");
96   key.append(kChromeAppHostGuid);
97   return key;
98 }
99
100 string16 ChromeAppHostDistribution::GetStateMediumKey() {
101   string16 key(google_update::kRegPathClientStateMedium);
102   key.append(L"\\");
103   key.append(kChromeAppHostGuid);
104   return key;
105 }
106
107 std::string ChromeAppHostDistribution::GetNetworkStatsServer() const {
108   return chrome_common_net::kEchoTestServerLocation;
109 }
110
111 std::string ChromeAppHostDistribution::GetHttpPipeliningTestServer() const {
112   return chrome_common_net::kPipelineTestServerBaseUrl;
113 }
114
115 string16 ChromeAppHostDistribution::GetUninstallLinkName() {
116   const string16& link_name =
117       installer::GetLocalizedString(IDS_UNINSTALL_APP_LAUNCHER_BASE);
118   return link_name;
119 }
120
121 string16 ChromeAppHostDistribution::GetUninstallRegPath() {
122   return L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
123          L"Google Chrome App Launcher";
124 }
125
126 string16 ChromeAppHostDistribution::GetVersionKey() {
127   string16 key(google_update::kRegPathClients);
128   key.append(L"\\");
129   key.append(kChromeAppHostGuid);
130   return key;
131 }
132
133 BrowserDistribution::DefaultBrowserControlPolicy
134     ChromeAppHostDistribution::GetDefaultBrowserControlPolicy() {
135   return DEFAULT_BROWSER_UNSUPPORTED;
136 }
137
138 bool ChromeAppHostDistribution::CanCreateDesktopShortcuts() {
139   return true;
140 }
141
142 string16 ChromeAppHostDistribution::GetIconFilename() {
143   return installer::kChromeAppHostExe;
144 }
145
146 bool ChromeAppHostDistribution::GetCommandExecuteImplClsid(
147     string16* handler_class_uuid) {
148   return false;
149 }
150
151 void 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 }