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

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: Created 7 years, 4 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 20 matching lines...) Expand all
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 40
41 // The Google Chrome App Launcher icon is index 5; see chrome_exe.rc.
42 const int kAppLauncherIconIndex = 5;
43
41 // Substitute the locale parameter in uninstall URL with whatever 44 // Substitute the locale parameter in uninstall URL with whatever
42 // Google Update tells us is the locale. In case we fail to find 45 // Google Update tells us is the locale. In case we fail to find
43 // the locale, we use US English. 46 // the locale, we use US English.
44 string16 LocalizeUrl(const wchar_t* url) { 47 string16 LocalizeUrl(const wchar_t* url) {
45 string16 language; 48 string16 language;
46 if (!GoogleUpdateSettings::GetLanguage(&language)) 49 if (!GoogleUpdateSettings::GetLanguage(&language))
47 language = L"en-US"; // Default to US English. 50 language = L"en-US"; // Default to US English.
48 return ReplaceStringPlaceholders(url, language.c_str(), NULL); 51 return ReplaceStringPlaceholders(url, language.c_str(), NULL);
49 } 52 }
50 53
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return product_guid(); 121 return product_guid();
119 } 122 }
120 123
121 string16 GoogleChromeDistribution::GetBaseAppName() { 124 string16 GoogleChromeDistribution::GetBaseAppName() {
122 // I'd really like to return L ## PRODUCT_FULLNAME_STRING; but that's no good 125 // 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 126 // since it'd be "Chromium" in a non-Chrome build, which isn't at all what I
124 // want. Sigh. 127 // want. Sigh.
125 return L"Google Chrome"; 128 return L"Google Chrome";
126 } 129 }
127 130
128 string16 GoogleChromeDistribution::GetAppShortCutName() { 131 string16 GoogleChromeDistribution::GetShortcutName(ShortcutType shortcut_type) {
129 const string16& app_shortcut_name = 132 int string_id = IDS_PRODUCT_NAME_BASE;
130 installer::GetLocalizedString(IDS_PRODUCT_NAME_BASE); 133 switch (shortcut_type) {
131 return app_shortcut_name; 134 case SHORTCUT_CHROME_ALTERNATE:
135 string_id = IDS_OEM_MAIN_SHORTCUT_NAME_BASE;
136 break;
137 case SHORTCUT_APP_LAUNCHER:
138 string_id = IDS_APP_LIST_SHORTCUT_NAME_BASE;
139 break;
140 default:
141 DCHECK_EQ(shortcut_type, SHORTCUT_CHROME);
142 break;
143 }
144 return installer::GetLocalizedString(string_id);
132 } 145 }
133 146
134 string16 GoogleChromeDistribution::GetAlternateApplicationName() { 147 int GoogleChromeDistribution::GetIconIndex(ShortcutType shortcut_type) {
135 const string16& alt_product_name = 148 if (shortcut_type == SHORTCUT_APP_LAUNCHER)
136 installer::GetLocalizedString(IDS_OEM_MAIN_SHORTCUT_NAME_BASE); 149 return kAppLauncherIconIndex;
137 return alt_product_name; 150 DCHECK(shortcut_type == SHORTCUT_CHROME ||
151 shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type;
152 return 0;
138 } 153 }
139 154
140 string16 GoogleChromeDistribution::GetBaseAppId() { 155 string16 GoogleChromeDistribution::GetBaseAppId() {
141 return kBrowserAppId; 156 return kBrowserAppId;
142 } 157 }
143 158
144 string16 GoogleChromeDistribution::GetInstallSubDir() { 159 string16 GoogleChromeDistribution::GetInstallSubDir() {
145 string16 sub_dir(installer::kGoogleChromeInstallSubDir1); 160 string16 sub_dir(installer::kGoogleChromeInstallSubDir1);
146 sub_dir.append(L"\\"); 161 sub_dir.append(L"\\");
147 sub_dir.append(installer::kGoogleChromeInstallSubDir2); 162 sub_dir.append(installer::kGoogleChromeInstallSubDir2);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 product_guid()); 286 product_guid());
272 } 287 }
273 288
274 bool GoogleChromeDistribution::ShouldSetExperimentLabels() { 289 bool GoogleChromeDistribution::ShouldSetExperimentLabels() {
275 return true; 290 return true;
276 } 291 }
277 292
278 bool GoogleChromeDistribution::HasUserExperiments() { 293 bool GoogleChromeDistribution::HasUserExperiments() {
279 return true; 294 return true;
280 } 295 }
OLDNEW
« no previous file with comments | « chrome/installer/util/google_chrome_distribution.h ('k') | chrome/installer/util/google_chrome_distribution_dummy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698