Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: chrome/installer/util/google_chrome_distribution.cc

Issue 15255004: Refactor of BrowserDistribution. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rework Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file defines specific implementation of BrowserDistribution class for 5 // This file defines specific implementation of BrowserDistribution class for
6 // Google Chrome. 6 // Google Chrome.
7 7
8 #include "chrome/installer/util/google_chrome_distribution.h" 8 #include "chrome/installer/util/google_chrome_distribution.h"
9 9
10 #include <windows.h> 10 #include <windows.h>
(...skipping 19 matching lines...) Expand all
30 #include "content/public/common/result_codes.h" 30 #include "content/public/common/result_codes.h"
31 31
32 #include "installer_util_strings.h" // NOLINT 32 #include "installer_util_strings.h" // NOLINT
33 33
34 namespace { 34 namespace {
35 35
36 const wchar_t kChromeGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; 36 const wchar_t kChromeGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
37 const wchar_t kBrowserAppId[] = L"Chrome"; 37 const wchar_t kBrowserAppId[] = L"Chrome";
38 const wchar_t kCommandExecuteImplUuid[] = 38 const wchar_t kCommandExecuteImplUuid[] =
39 L"{5C65F4B0-3651-4514-B207-D10CB699B14B}"; 39 L"{5C65F4B0-3651-4514-B207-D10CB699B14B}";
40 const int kAppLauncherIconIndex = 5;
40 41
41 // Substitute the locale parameter in uninstall URL with whatever 42 // Substitute the locale parameter in uninstall URL with whatever
42 // Google Update tells us is the locale. In case we fail to find 43 // Google Update tells us is the locale. In case we fail to find
43 // the locale, we use US English. 44 // the locale, we use US English.
44 string16 LocalizeUrl(const wchar_t* url) { 45 string16 LocalizeUrl(const wchar_t* url) {
45 string16 language; 46 string16 language;
46 if (!GoogleUpdateSettings::GetLanguage(&language)) 47 if (!GoogleUpdateSettings::GetLanguage(&language))
47 language = L"en-US"; // Default to US English. 48 language = L"en-US"; // Default to US English.
48 return ReplaceStringPlaceholders(url, language.c_str(), NULL); 49 return ReplaceStringPlaceholders(url, language.c_str(), NULL);
49 } 50 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return product_guid(); 119 return product_guid();
119 } 120 }
120 121
121 string16 GoogleChromeDistribution::GetBaseAppName() { 122 string16 GoogleChromeDistribution::GetBaseAppName() {
122 // I'd really like to return L ## PRODUCT_FULLNAME_STRING; but that's no good 123 // I'd really like to return L ## PRODUCT_FULLNAME_STRING; but that's no good
123 // since it'd be "Chromium" in a non-Chrome build, which isn't at all what I 124 // since it'd be "Chromium" in a non-Chrome build, which isn't at all what I
124 // want. Sigh. 125 // want. Sigh.
125 return L"Google Chrome"; 126 return L"Google Chrome";
126 } 127 }
127 128
128 string16 GoogleChromeDistribution::GetAppShortCutName() { 129 string16 GoogleChromeDistribution::GetShortcutName(ShortcutType shortcut_type) {
129 const string16& app_shortcut_name = 130 int string_id = IDS_PRODUCT_NAME_BASE;
130 installer::GetLocalizedString(IDS_PRODUCT_NAME_BASE); 131 switch (shortcut_type) {
131 return app_shortcut_name; 132 case SHORTCUT_CHROME_ALTERNATE:
133 string_id = IDS_OEM_MAIN_SHORTCUT_NAME_BASE;
134 break;
135 case SHORTCUT_APP_LAUNCHER:
136 string_id = IDS_APP_LIST_SHORTCUT_NAME_BASE;
137 break;
138 default:
139 DCHECK_EQ(shortcut_type, SHORTCUT_CHROME);
140 break;
141 }
142 return installer::GetLocalizedString(string_id);
132 } 143 }
133 144
134 string16 GoogleChromeDistribution::GetAlternateApplicationName() { 145 int GoogleChromeDistribution::GetIconIndex(ShortcutType shortcut_type) {
135 const string16& alt_product_name = 146 // The Google Chrome App Launcher icon is index 5; see chrome_exe.rc.
grt (UTC plus 2) 2013/07/16 19:38:44 please move this comment to the definition of kApp
calamity 2013/07/18 07:56:14 Done.
136 installer::GetLocalizedString(IDS_OEM_MAIN_SHORTCUT_NAME_BASE); 147 if (shortcut_type == SHORTCUT_APP_LAUNCHER)
137 return alt_product_name; 148 return kAppLauncherIconIndex;
149 DCHECK(shortcut_type == SHORTCUT_CHROME ||
150 shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type;
151 return 0;
138 } 152 }
139 153
140 string16 GoogleChromeDistribution::GetBaseAppId() { 154 string16 GoogleChromeDistribution::GetBaseAppId() {
141 return kBrowserAppId; 155 return kBrowserAppId;
142 } 156 }
143 157
144 string16 GoogleChromeDistribution::GetInstallSubDir() { 158 string16 GoogleChromeDistribution::GetInstallSubDir() {
145 string16 sub_dir(installer::kGoogleChromeInstallSubDir1); 159 string16 sub_dir(installer::kGoogleChromeInstallSubDir1);
146 sub_dir.append(L"\\"); 160 sub_dir.append(L"\\");
147 sub_dir.append(installer::kGoogleChromeInstallSubDir2); 161 sub_dir.append(installer::kGoogleChromeInstallSubDir2);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 product_guid()); 285 product_guid());
272 } 286 }
273 287
274 bool GoogleChromeDistribution::ShouldSetExperimentLabels() { 288 bool GoogleChromeDistribution::ShouldSetExperimentLabels() {
275 return true; 289 return true;
276 } 290 }
277 291
278 bool GoogleChromeDistribution::HasUserExperiments() { 292 bool GoogleChromeDistribution::HasUserExperiments() {
279 return true; 293 return true;
280 } 294 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698