OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_INSTALLER_UTIL_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_ | |
6 #define CHROME_INSTALLER_UTIL_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/strings/string16.h" | |
10 #include "chrome/installer/util/set_reg_value_work_item.h" | |
11 | |
12 // A WorkItem that updates (or installs if not present) the Active Setup | |
13 // "Version" field in the registry. Optionally bumping the OS_UPGRADES component | |
14 // on demand. This WorkItem is only viable on machine-wide installs. | |
15 // TODO(gab): This would be cleaner if UpdateActiveSetupVersionWorkItem | |
grt (UTC plus 2)
2015/07/09 14:23:53
since you're modifying SetRegValueWorkItem to make
gab
2015/07/09 20:36:38
The reason I didn't do this is that friend'ing giv
grt (UTC plus 2)
2015/07/10 15:37:27
I see your point, but I think that's less bad than
gab
2015/07/13 16:37:38
In that case, I think moving the constructors to p
| |
16 // embedded a SetRegValueWorkItem instead of being one, but this is not possible | |
17 // in today's "private constructor + creator friends" WorkItem model :-(. | |
18 class UpdateActiveSetupVersionWorkItem : public SetRegValueWorkItem { | |
19 public: | |
20 // The operation to be performed by this UpdateActiveSetupVersionWorkItem. | |
21 enum Operation { | |
grt (UTC plus 2)
2015/07/09 14:23:53
why not enum class?
gab
2015/07/09 20:36:38
Only because it makes constructor calls even more
grt (UTC plus 2)
2015/07/10 15:37:27
Nah, I was just curious. Enum class does require a
| |
22 // Update (or install if not present) the Active Setup "Version" in the | |
23 // registry. | |
24 UPDATE, | |
25 // Also bump the OS_UPGRADES component on top of updating the version | |
26 // (will default to 1 if the version was absent or invalid). | |
27 UPDATE_AND_BUMP_OS_UPGRADES_COMPONENT, | |
28 }; | |
29 | |
30 // Constructs an UpdateActiveSetupVersionWorkItem that will perform | |
31 // |operation_| on the |active_setup_path| key in the registry. This key needs | |
grt (UTC plus 2)
2015/07/09 14:23:53
nit: |operation|
gab
2015/07/09 20:36:38
Done.
| |
32 // to exist when this WorkItem is ran. | |
33 UpdateActiveSetupVersionWorkItem(const base::string16& active_setup_path, | |
grt (UTC plus 2)
2015/07/09 14:23:53
nit: make order of params and order of description
gab
2015/07/09 20:36:38
I think the callsites read better in this order ye
grt (UTC plus 2)
2015/07/10 15:37:27
Only saying because I think I've been asked to do
gab
2015/07/13 16:37:38
Possible :-), it's kind of arbitrary, but here I p
| |
34 Operation operation); | |
35 | |
36 private: | |
37 // The components of the Active Setup Version entry, in order. | |
38 enum ActiveSetupVersionComponent { | |
39 // The major version. | |
40 MAJOR, | |
41 // Unused component, always 0 for now. | |
42 UNUSED1, | |
43 // Number of OS upgrades handled since original install. | |
grt (UTC plus 2)
2015/07/09 14:23:53
should this warp back to zero each time the major
gab
2015/07/09 20:36:38
Interesting, no major reason other than that this
gab
2015/07/09 20:46:10
Actually just thought of a reason, in my upcoming
| |
44 OS_UPGRADES, | |
45 // Unused component, always 0 for now. | |
46 UNUSED2, | |
47 }; | |
48 | |
49 // Returns the updated Active Setup version to be used based on the | |
50 // |existing_version|. | |
51 base::string16 GetUpdatedActiveSetupVersion( | |
52 const base::string16& existing_version); | |
53 | |
54 // The Operation to be performed by this WorkItem when executed. | |
55 const Operation operation_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(UpdateActiveSetupVersionWorkItem); | |
58 }; | |
59 | |
60 #endif // CHROME_INSTALLER_UTIL_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_ | |
OLD | NEW |