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

Unified Diff: chrome/installer/setup/update_active_setup_version_work_item.h

Issue 1223953003: Introduce UpdateActiveSetupVersionWorkItem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a1_active_setup_onosup_addCB_API
Patch Set: merge to r338517 add GN support for setup_unittests Created 5 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
« no previous file with comments | « chrome/installer/setup/BUILD.gn ('k') | chrome/installer/setup/update_active_setup_version_work_item.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/setup/update_active_setup_version_work_item.h
diff --git a/chrome/installer/setup/update_active_setup_version_work_item.h b/chrome/installer/setup/update_active_setup_version_work_item.h
new file mode 100644
index 0000000000000000000000000000000000000000..03aec4435a39142a29dd21db47cc1dab9fc4fc65
--- /dev/null
+++ b/chrome/installer/setup/update_active_setup_version_work_item.h
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_INSTALLER_SETUP_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_
+#define CHROME_INSTALLER_SETUP_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_
+
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "chrome/installer/util/set_reg_value_work_item.h"
+#include "chrome/installer/util/work_item.h"
+
+// A WorkItem that updates (or installs if not present) the Active Setup
+// "Version" field in the registry. Optionally bumping the OS_UPGRADES component
+// on demand. This WorkItem is only viable on machine-wide installs.
+class UpdateActiveSetupVersionWorkItem : public WorkItem {
+ public:
+ // The operation to be performed by this UpdateActiveSetupVersionWorkItem.
+ enum Operation {
+ // Update (or install if not present) the Active Setup "Version" in the
+ // registry.
+ UPDATE,
+ // Also bump the OS_UPGRADES component on top of updating the version
+ // (will default to 1 if the version was absent or invalid).
+ UPDATE_AND_BUMP_OS_UPGRADES_COMPONENT,
+ };
+
+ // Constructs an UpdateActiveSetupVersionWorkItem that will perform
+ // |operation| on the |active_setup_path| key in the registry. This key needs
+ // to exist when this WorkItem is ran.
+ UpdateActiveSetupVersionWorkItem(const base::string16& active_setup_path,
+ Operation operation);
+
+ // Overriden from WorkItem.
+ bool Do() override;
+ void Rollback() override;
+
+ private:
+ // The components of the Active Setup Version entry, in order.
+ enum ActiveSetupVersionComponent {
+ // The major version.
+ MAJOR,
+ // Unused component, always 0 for now.
+ UNUSED1,
+ // Number of OS upgrades handled since original install.
+ OS_UPGRADES,
+ // Unused component, always 0 for now.
+ UNUSED2,
+ };
+
+ // Returns the updated Active Setup version to be used based on the
+ // |existing_version|.
+ base::string16 GetUpdatedActiveSetupVersion(
+ const base::string16& existing_version);
+
+ // The underlying WorkItem re-used to operate forward and backward on the
+ // registry.
+ SetRegValueWorkItem set_reg_value_work_item_;
+
+ // The Operation to be performed by this WorkItem when executed.
+ const Operation operation_;
+
+ DISALLOW_COPY_AND_ASSIGN(UpdateActiveSetupVersionWorkItem);
+};
+
+#endif // CHROME_INSTALLER_SETUP_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_
« no previous file with comments | « chrome/installer/setup/BUILD.gn ('k') | chrome/installer/setup/update_active_setup_version_work_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698