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

Unified Diff: chrome/installer/util/browser_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 side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/browser_distribution.cc
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index 4f711419db140c7338e7eeaeef6331f99c93f301..b3b7af7354c3eaaa888c43cb6a2374601c1ba533 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -39,6 +39,9 @@ const wchar_t kChromiumActiveSetupGuid[] =
const wchar_t kCommandExecuteImplUuid[] =
L"{A2DF06F9-A21A-44A8-8A99-8B9C84F29160}";
+// The Chromium App Launcher icon is index 1; see chrome_exe.rc.
+const int kAppLauncherIconIndex = 1;
+
// The BrowserDistribution objects are never freed.
BrowserDistribution* g_browser_distribution = NULL;
BrowserDistribution* g_chrome_frame_distribution = NULL;
@@ -154,12 +157,47 @@ string16 BrowserDistribution::GetBaseAppName() {
return L"Chromium";
}
-string16 BrowserDistribution::GetAppShortCutName() {
- return GetBaseAppName();
+string16 BrowserDistribution::GetDisplayName() {
+ return GetShortcutName(SHORTCUT_CHROME);
+}
+
+string16 BrowserDistribution::GetShortcutName(ShortcutType shortcut_type) {
+ switch (shortcut_type) {
+ case SHORTCUT_CHROME_ALTERNATE:
+ // TODO(calamity): Change IDS_OEM_MAIN_SHORTCUT_NAME in
+ // chromium_strings.grd to "The Internet" (so that it doesn't collide with
+ // the value in google_chrome_strings.grd) then change this to
+ // installer::GetLocalizedString(IDS_OEM_MAIN_SHORTCUT_NAME_BASE)
+ return L"The Internet";
+ case SHORTCUT_APP_LAUNCHER:
+ return installer::GetLocalizedString(IDS_APP_LIST_SHORTCUT_NAME_BASE);
+ default:
+ DCHECK_EQ(shortcut_type, SHORTCUT_CHROME);
+ return GetBaseAppName();
+ }
}
-string16 BrowserDistribution::GetAlternateApplicationName() {
- return L"The Internet";
+int BrowserDistribution::GetIconIndex(ShortcutType shortcut_type) {
+ if (shortcut_type == SHORTCUT_APP_LAUNCHER)
+ return kAppLauncherIconIndex;
+ DCHECK(shortcut_type == SHORTCUT_CHROME ||
+ shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type;
+ return 0;
+}
+
+string16 BrowserDistribution::GetIconFilename() {
+ return string16();
+}
+
+string16 BrowserDistribution::GetStartMenuShortcutSubfolder(
+ Subfolder subfolder_type) {
+ switch (subfolder_type) {
grt (UTC plus 2) 2013/07/16 19:38:44 remove this switch statement. the only two lines n
calamity 2013/07/18 07:56:14 Done.
+ case SUBFOLDER_CHROME:
+ return GetShortcutName(SHORTCUT_CHROME);
+ default:
+ DCHECK_EQ(subfolder_type, SUBFOLDER_CHROME);
+ return GetShortcutName(SHORTCUT_CHROME);
+ }
}
string16 BrowserDistribution::GetBaseAppId() {
@@ -228,16 +266,6 @@ bool BrowserDistribution::CanCreateDesktopShortcuts() {
return true;
}
-string16 BrowserDistribution::GetIconFilename() {
- return string16();
-}
-
-int BrowserDistribution::GetIconIndex() {
- // Assuming that main icon appears first alphabetically in the resource file
- // for GetIconFilename().
- return 0;
-}
-
bool BrowserDistribution::GetChromeChannel(string16* channel) {
return false;
}

Powered by Google App Engine
This is Rietveld 408576698