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

Side by Side Diff: chrome/installer/setup/update_active_setup_version_work_item.h

Issue 2897593003: Generalize Active Setup triggering. (Closed)
Patch Set: test fixins Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CHROME_INSTALLER_SETUP_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_ 5 #ifndef CHROME_INSTALLER_SETUP_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_
6 #define CHROME_INSTALLER_SETUP_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_ 6 #define CHROME_INSTALLER_SETUP_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "chrome/installer/util/set_reg_value_work_item.h" 10 #include "chrome/installer/util/set_reg_value_work_item.h"
11 #include "chrome/installer/util/work_item.h" 11 #include "chrome/installer/util/work_item.h"
12 12
13 // A WorkItem that updates (or installs if not present) the Active Setup 13 // A WorkItem that updates (or installs if not present) the Active Setup
14 // "Version" field in the registry. Optionally bumping the OS_UPGRADES component 14 // "Version" field in the registry. Optionally bumping the SELECTIVE_TRIGGER
15 // on demand. This WorkItem is only viable on machine-wide installs. 15 // component on demand. This WorkItem is only viable on machine-wide installs.
16 class UpdateActiveSetupVersionWorkItem : public WorkItem { 16 class UpdateActiveSetupVersionWorkItem : public WorkItem {
17 public: 17 public:
18 // The components of the Active Setup Version entry, in order. 18 // The components of the Active Setup Version entry, in order.
19 enum VersionComponent { 19 enum VersionComponent {
20 // The major version. 20 // The major version.
21 MAJOR, 21 MAJOR,
22 // Unused component, always 0 for now. 22 // Unused component, always 0 for now.
23 UNUSED1, 23 UNUSED1,
24 // Number of OS upgrades handled since original install. 24 // A component used to selectively trigger Active Setup based on local
25 OS_UPGRADES, 25 // factors such as an OS upgrade.
26 SELECTIVE_TRIGGER,
26 // Unused component, always 0 for now. 27 // Unused component, always 0 for now.
27 UNUSED2, 28 UNUSED2,
28 }; 29 };
29 30
30 // The operation to be performed by this UpdateActiveSetupVersionWorkItem. 31 // The operation to be performed by this UpdateActiveSetupVersionWorkItem.
31 enum Operation { 32 enum Operation {
32 // Update (or install if not present) the Active Setup "Version" in the 33 // Update (or install if not present) the Active Setup "Version" in the
33 // registry. 34 // registry.
34 UPDATE, 35 UPDATE,
35 // Also bump the OS_UPGRADES component on top of updating the version 36 // Also bump the SELECTIVE_TRIGGER component on top of updating the version
36 // (will default to 1 if the version was absent or invalid). 37 // (will default to 1 if the version was absent or invalid).
37 UPDATE_AND_BUMP_OS_UPGRADES_COMPONENT, 38 UPDATE_AND_BUMP_SELECTIVE_TRIGGER,
38 }; 39 };
39 40
40 // Constructs an UpdateActiveSetupVersionWorkItem that will perform 41 // Constructs an UpdateActiveSetupVersionWorkItem that will perform
41 // |operation| on the |active_setup_path| key in the registry. This key needs 42 // |operation| on the |active_setup_path| key in the registry. This key needs
42 // to exist when this WorkItem is ran. 43 // to exist when this WorkItem is ran.
43 UpdateActiveSetupVersionWorkItem(const base::string16& active_setup_path, 44 UpdateActiveSetupVersionWorkItem(const base::string16& active_setup_path,
44 Operation operation); 45 Operation operation);
45 46
46 private: 47 private:
47 // WorkItem: 48 // WorkItem:
48 bool DoImpl() override; 49 bool DoImpl() override;
49 void RollbackImpl() override; 50 void RollbackImpl() override;
50 51
51 // Returns the updated Active Setup version to be used based on the 52 // Returns the updated Active Setup version to be used based on the
52 // |existing_version|. 53 // |existing_version|.
53 base::string16 GetUpdatedActiveSetupVersion( 54 base::string16 GetUpdatedActiveSetupVersion(
54 const base::string16& existing_version); 55 const base::string16& existing_version);
55 56
56 // The underlying WorkItem re-used to operate forward and backward on the 57 // The underlying WorkItem re-used to operate forward and backward on the
57 // registry. 58 // registry.
58 SetRegValueWorkItem set_reg_value_work_item_; 59 SetRegValueWorkItem set_reg_value_work_item_;
59 60
60 // The Operation to be performed by this WorkItem when executed. 61 // The Operation to be performed by this WorkItem when executed.
61 const Operation operation_; 62 const Operation operation_;
62 63
63 DISALLOW_COPY_AND_ASSIGN(UpdateActiveSetupVersionWorkItem); 64 DISALLOW_COPY_AND_ASSIGN(UpdateActiveSetupVersionWorkItem);
64 }; 65 };
65 66
66 #endif // CHROME_INSTALLER_SETUP_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_ 67 #endif // CHROME_INSTALLER_SETUP_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698