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

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

Issue 1231973002: Force restoration of Chrome's shortcuts when Active Setup kicks in in response to a major OS upgrad… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a4_use_as_workitem
Patch Set: 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 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_UTIL_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_ 5 #ifndef CHROME_INSTALLER_UTIL_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_
6 #define CHROME_INSTALLER_UTIL_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_ 6 #define CHROME_INSTALLER_UTIL_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 11
12 // A WorkItem that updates (or installs if not present) the Active Setup 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 13 // "Version" field in the registry. Optionally bumping the OS_UPGRADES component
14 // on demand. This WorkItem is only viable on machine-wide installs. 14 // on demand. This WorkItem is only viable on machine-wide installs.
15 // TODO(gab): This would be cleaner if UpdateActiveSetupVersionWorkItem 15 // TODO(gab): This would be cleaner if UpdateActiveSetupVersionWorkItem
16 // embedded a SetRegValueWorkItem instead of being one, but this is not possible 16 // embedded a SetRegValueWorkItem instead of being one, but this is not possible
17 // in today's "private constructor + creator friends" WorkItem model :-(. 17 // in today's "private constructor + creator friends" WorkItem model :-(.
18 class UpdateActiveSetupVersionWorkItem : public SetRegValueWorkItem { 18 class UpdateActiveSetupVersionWorkItem : public SetRegValueWorkItem {
19 public: 19 public:
20 // The components of the Active Setup Version entry, in order.
21 enum VersionComponent {
22 // The major version.
23 MAJOR,
24 // Unused component, always 0 for now.
25 UNUSED1,
26 // Number of OS upgrades handled since original install.
27 OS_UPGRADES,
28 // Unused component, always 0 for now.
29 UNUSED2,
30 };
31
20 // The operation to be performed by this UpdateActiveSetupVersionWorkItem. 32 // The operation to be performed by this UpdateActiveSetupVersionWorkItem.
21 enum Operation { 33 enum Operation {
22 // Update (or install if not present) the Active Setup "Version" in the 34 // Update (or install if not present) the Active Setup "Version" in the
23 // registry. 35 // registry.
24 UPDATE, 36 UPDATE,
25 // Also bump the OS_UPGRADES component on top of updating the version 37 // Also bump the OS_UPGRADES component on top of updating the version
26 // (will default to 1 if the version was absent or invalid). 38 // (will default to 1 if the version was absent or invalid).
27 UPDATE_AND_BUMP_OS_UPGRADES_COMPONENT, 39 UPDATE_AND_BUMP_OS_UPGRADES_COMPONENT,
28 }; 40 };
29 41
30 // Constructs an UpdateActiveSetupVersionWorkItem that will perform 42 // Constructs an UpdateActiveSetupVersionWorkItem that will perform
31 // |operation| on the |active_setup_path| key in the registry. This key needs 43 // |operation| on the |active_setup_path| key in the registry. This key needs
32 // to exist when this WorkItem is ran. 44 // to exist when this WorkItem is ran.
33 UpdateActiveSetupVersionWorkItem(const base::string16& active_setup_path, 45 UpdateActiveSetupVersionWorkItem(const base::string16& active_setup_path,
34 Operation operation); 46 Operation operation);
35 47
36 private: 48 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.
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 49 // Returns the updated Active Setup version to be used based on the
50 // |existing_version|. 50 // |existing_version|.
51 base::string16 GetUpdatedActiveSetupVersion( 51 base::string16 GetUpdatedActiveSetupVersion(
52 const base::string16& existing_version); 52 const base::string16& existing_version);
53 53
54 // The Operation to be performed by this WorkItem when executed. 54 // The Operation to be performed by this WorkItem when executed.
55 const Operation operation_; 55 const Operation operation_;
56 56
57 DISALLOW_COPY_AND_ASSIGN(UpdateActiveSetupVersionWorkItem); 57 DISALLOW_COPY_AND_ASSIGN(UpdateActiveSetupVersionWorkItem);
58 }; 58 };
59 59
60 #endif // CHROME_INSTALLER_UTIL_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_ 60 #endif // CHROME_INSTALLER_UTIL_UPDATE_ACTIVE_SETUP_VERSION_WORK_ITEM_H_
OLDNEW
« chrome/installer/util/install_util.cc ('K') | « chrome/installer/util/install_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698