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

Unified Diff: chrome/installer/setup/install_worker.cc

Issue 10160011: Create VisualElementsManifest.xml from template -- install VisualElements in the version directory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove shortname property Created 8 years, 8 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/setup/install_worker.cc
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc
index cd17feea47e150abf09e29bb9bc847b780027d0f..aea4690b1857903a53601924b87b77c670330f81 100644
--- a/chrome/installer/setup/install_worker.cc
+++ b/chrome/installer/setup/install_worker.cc
@@ -7,9 +7,11 @@
#include "chrome/installer/setup/install_worker.h"
+#include <map>
#include <oaidl.h>
#include <shlobj.h>
#include <time.h>
+#include <utility>
#include <vector>
#include "base/command_line.h"
@@ -42,6 +44,27 @@
using base::win::RegKey;
+namespace {
+
+// Elements that make up install target paths.
+const wchar_t kDictionaries[] = L"Dictionaries";
+const wchar_t kImages[] = L"Images";
+const wchar_t kLogoImage[] = L"Logo.png";
+const wchar_t kSmallLogoImage[] = L"SmallLogo.png";
+const wchar_t kSplashScreenImage[] = L"splash-620x300.png";
+const wchar_t kVisualElementsManifest[] = L"VisualElementsManifest.xml";
+const wchar_t kVisualElementsManifestTemplate[] =
+ L"VisualElementsManifest_template.xml";
+const wchar_t kWowHelperExe[] = L"wow_helper.exe";
+
+// Template variables used in kVisualElementsManifestTemplateXml.
+const wchar_t kDisplayNameVar[] = L"DISPLAYNAME";
+const wchar_t kLogoVar[] = L"LOGO";
+const wchar_t kSmallLogoVar[] = L"SMALLLOGO";
+const wchar_t kSplashScreenVar[] = L"SPLASH";
+
+} // namespace
+
namespace installer {
// Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of
@@ -769,8 +792,8 @@ void AddInstallWorkItems(const InstallationState& original_state,
base::win::OSInfo::WOW64_DISABLED &&
base::win::GetVersion() <= base::win::VERSION_VISTA) {
install_list->AddMoveTreeWorkItem(
- src_path.Append(installer::kWowHelperExe).value(),
- target_path.Append(installer::kWowHelperExe).value(),
+ src_path.Append(kWowHelperExe).value(),
+ target_path.Append(kWowHelperExe).value(),
temp_path.value(),
WorkItem::ALWAYS_MOVE);
}
@@ -780,29 +803,27 @@ void AddInstallWorkItems(const InstallationState& original_state,
// to include visual elements.
scoped_ptr<WorkItemList> win8_work_items(
WorkItem::CreateConditionalWorkItemList(new ConditionRunIfFileExists(
- src_path.Append(L"visualelementsmanifest.xml"))));
- // TODO (gab): All of these hard-coded strings are temporary and will be
- // deleted in the patch following this one.
- win8_work_items->AddMoveTreeWorkItem(
- src_path.Append(L"visualelementsmanifest.xml").value(),
- target_path.Append(L"visualelementsmanifest.xml").value(),
+ src_path.Append(kVisualElementsManifestTemplate))));
+
+ // Map all template variables to their desired values for this install.
+ std::map<string16, string16> mappings;
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ string16 images_dir = ASCIIToUTF16(new_version.GetString());
+ images_dir.push_back(FilePath::kSeparators[0]);
+ images_dir.append(kImages);
+ images_dir.push_back(FilePath::kSeparators[0]);
+ mappings.insert(make_pair(kDisplayNameVar, dist->GetAppShortCutName()));
+ mappings.insert(make_pair(kLogoVar, images_dir + kLogoImage));
+ mappings.insert(make_pair(kSmallLogoVar, images_dir + kSmallLogoImage));
+ mappings.insert(make_pair(
+ kSplashScreenVar, images_dir + kSplashScreenImage));
+
+ win8_work_items->AddFileFromTemplateWorkItem(
+ src_path.Append(kVisualElementsManifestTemplate).value(),
+ target_path.Append(kVisualElementsManifest).value(),
temp_path.value(),
- WorkItem::ALWAYS_MOVE);
- win8_work_items->AddMoveTreeWorkItem(
- src_path.Append(L"logo.png").value(),
- target_path.Append(L"logo.png").value(),
- temp_path.value(),
- WorkItem::ALWAYS_MOVE);
- win8_work_items->AddMoveTreeWorkItem(
- src_path.Append(L"smalllogo.png").value(),
- target_path.Append(L"smalllogo.png").value(),
- temp_path.value(),
- WorkItem::ALWAYS_MOVE);
- win8_work_items->AddMoveTreeWorkItem(
- src_path.Append(L"splash-620x300.png").value(),
- target_path.Append(L"splash-620x300.png").value(),
- temp_path.value(),
- WorkItem::ALWAYS_MOVE);
+ mappings);
+
install_list->AddWorkItem(win8_work_items.release());
}
@@ -826,8 +847,8 @@ void AddInstallWorkItems(const InstallationState& original_state,
// TODO(grt): Use AddMoveTreeWorkItem in a conditional WorkItemList, which
// will be more efficient in space and time.
install_list->AddCopyTreeWorkItem(
- src_path.Append(installer::kDictionaries).value(),
- target_path.Append(installer::kDictionaries).value(),
+ src_path.Append(kDictionaries).value(),
+ target_path.Append(kDictionaries).value(),
temp_path.value(), WorkItem::IF_NOT_PRESENT);
// Delete any old_chrome.exe if present (ignore failure if it's in use).

Powered by Google App Engine
This is Rietveld 408576698