Index: chrome/installer/setup/install_worker.cc |
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc |
index 4824016a21eafc096c1b9da61ad012fcbcf0dc18..e5d092a02be57cfadc8bc1e1b0a90bb66fa88444 100644 |
--- a/chrome/installer/setup/install_worker.cc |
+++ b/chrome/installer/setup/install_worker.cc |
@@ -20,6 +20,7 @@ |
#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/path_service.h" |
+#include "base/strings/string_split.h" |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/version.h" |
@@ -57,12 +58,6 @@ namespace installer { |
namespace { |
-// The version identifying the work done by setup.exe --configure-user-settings |
-// on user login by way of Active Setup. Increase this value if the work done |
-// in setup_main.cc's handling of kConfigureUserSettings changes and should be |
-// executed again for all users. |
-const wchar_t kActiveSetupVersion[] = L"43,0,0,0"; |
- |
// Although the UUID of the ChromeFrame class is used for the "current" value, |
// this is done only as a convenience; there is no need for the GUID of the Low |
// Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to |
@@ -541,6 +536,32 @@ void CleanupBadCanaryDelegateExecuteRegistration( |
} |
} |
+// Returns the version to be used for Active Setup as MM,XX,YY,ZZ where MM is |
+// |kActiveSetupMajorVersion| and other components may be updated in various |
+// situations. At this point YY represents the number of on-os-upgrade that were |
+// handled by this installation and XX/ZZ are unused. |
+base::string16 GetActiveSetupVersionFromExisting( |
+ const base::string16& existing_version) { |
+ // The major version and first component of the version identifying the work |
+ // done by setup.exe --configure-user-settings on user login by way of Active |
+ // Setup. Increase this value if the work done in setup_main.cc's handling of |
+ // kConfigureUserSettings changes and should be executed again for all users. |
+ const base::char16 kActiveSetupMajorVersion[] = L"43"; |
+ |
+ std::vector<base::string16> version_components = base::SplitString( |
+ existing_version, L",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
+ |
+ // If |existing_version| was empty or otherwise corrupted, turn it into a |
+ // valid one. |
+ if (version_components.size() != 4U) |
+ version_components.assign(4U, L"0"); |
+ |
+ // Unconditionally update the major version. |
+ version_components[0] = kActiveSetupMajorVersion; |
+ |
+ return JoinString(version_components, L','); |
+} |
+ |
} // namespace |
// This method adds work items to create (or update) Chrome uninstall entry in |
@@ -1241,7 +1262,7 @@ void AddInstallWorkItems(const InstallationState& original_state, |
AddDelegateExecuteWorkItems(installer_state, target_path, new_version, |
product, install_list); |
- AddActiveSetupWorkItems(installer_state, setup_path, new_version, product, |
+ AddActiveSetupWorkItems(installer_state, new_version, product, |
install_list); |
} |
@@ -1399,7 +1420,6 @@ void AddDelegateExecuteWorkItems(const InstallerState& installer_state, |
} |
void AddActiveSetupWorkItems(const InstallerState& installer_state, |
- const base::FilePath& setup_path, |
const Version& new_version, |
const Product& product, |
WorkItemList* list) { |
@@ -1462,8 +1482,7 @@ void AddActiveSetupWorkItems(const InstallerState& installer_state, |
active_setup_path, |
WorkItem::kWow64Default, |
L"Version", |
- kActiveSetupVersion, |
- true); |
+ base::Bind(&GetActiveSetupVersionFromExisting)); |
} |
void AddDeleteOldIELowRightsPolicyWorkItems( |