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

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

Issue 10160011: Create VisualElementsManifest.xml from template -- install VisualElements in the version directory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove shortname property Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Base class for managing an action of a sequence of actions to be carried 5 // Base class for managing an action of a sequence of actions to be carried
6 // out during install/update/uninstall. Supports rollback of actions if this 6 // out during install/update/uninstall. Supports rollback of actions if this
7 // process fails. 7 // process fails.
8 8
9 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_H_ 9 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_H_
10 #define CHROME_INSTALLER_UTIL_WORK_ITEM_H_ 10 #define CHROME_INSTALLER_UTIL_WORK_ITEM_H_
11 #pragma once 11 #pragma once
12 12
13 #include <windows.h> 13 #include <windows.h>
14 14
15 #include <string> 15 #include <map>
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/basictypes.h" 18 #include "base/basictypes.h"
19 #include "base/string16.h"
19 20
20 class CopyRegKeyWorkItem; 21 class CopyRegKeyWorkItem;
21 class CopyTreeWorkItem; 22 class CopyTreeWorkItem;
22 class CreateDirWorkItem; 23 class CreateDirWorkItem;
23 class CreateRegKeyWorkItem; 24 class CreateRegKeyWorkItem;
24 class DeleteTreeWorkItem; 25 class DeleteTreeWorkItem;
25 class DeleteRegKeyWorkItem; 26 class DeleteRegKeyWorkItem;
26 class DeleteRegValueWorkItem; 27 class DeleteRegValueWorkItem;
28 class FileFromTemplateWorkItem;
27 class FilePath; 29 class FilePath;
28 class MoveTreeWorkItem; 30 class MoveTreeWorkItem;
29 class SelfRegWorkItem; 31 class SelfRegWorkItem;
30 class SetRegValueWorkItem; 32 class SetRegValueWorkItem;
31 class WorkItemList; 33 class WorkItemList;
32 34
33 // A base class that defines APIs to perform/rollback an action or a 35 // A base class that defines APIs to perform/rollback an action or a
34 // sequence of actions during install/update/uninstall. 36 // sequence of actions during install/update/uninstall.
35 class WorkItem { 37 class WorkItem {
36 public: 38 public:
(...skipping 18 matching lines...) Expand all
55 public: 57 public:
56 virtual ~Condition() {} 58 virtual ~Condition() {}
57 virtual bool ShouldRun() const = 0; 59 virtual bool ShouldRun() const = 0;
58 }; 60 };
59 61
60 virtual ~WorkItem(); 62 virtual ~WorkItem();
61 63
62 // Create a CopyRegKeyWorkItem that recursively copies a given registry key. 64 // Create a CopyRegKeyWorkItem that recursively copies a given registry key.
63 static CopyRegKeyWorkItem* CreateCopyRegKeyWorkItem( 65 static CopyRegKeyWorkItem* CreateCopyRegKeyWorkItem(
64 HKEY predefined_root, 66 HKEY predefined_root,
65 const std::wstring& source_key_path, 67 const string16& source_key_path,
66 const std::wstring& dest_key_path, 68 const string16& dest_key_path,
67 CopyOverWriteOption overwrite_option); 69 CopyOverWriteOption overwrite_option);
68 70
69 // Create a CopyTreeWorkItem that recursively copies a file system hierarchy 71 // Create a CopyTreeWorkItem that recursively copies a file system hierarchy
70 // from source path to destination path. 72 // from source path to destination path.
71 // * If overwrite_option is ALWAYS, the created CopyTreeWorkItem always 73 // * If overwrite_option is ALWAYS, the created CopyTreeWorkItem always
72 // overwrites files. 74 // overwrites files.
73 // * If overwrite_option is NEW_NAME_IF_IN_USE, file is copied with an 75 // * If overwrite_option is NEW_NAME_IF_IN_USE, file is copied with an
74 // alternate name specified by alternative_path. 76 // alternate name specified by alternative_path.
75 static CopyTreeWorkItem* CreateCopyTreeWorkItem( 77 static CopyTreeWorkItem* CreateCopyTreeWorkItem(
76 const FilePath& source_path, 78 const FilePath& source_path,
77 const FilePath& dest_path, 79 const FilePath& dest_path,
78 const FilePath& temp_dir, 80 const FilePath& temp_dir,
79 CopyOverWriteOption overwrite_option, 81 CopyOverWriteOption overwrite_option,
80 const FilePath& alternative_path); 82 const FilePath& alternative_path);
81 83
82 // Create a CreateDirWorkItem that creates a directory at the given path. 84 // Create a CreateDirWorkItem that creates a directory at the given path.
83 static CreateDirWorkItem* CreateCreateDirWorkItem(const FilePath& path); 85 static CreateDirWorkItem* CreateCreateDirWorkItem(const FilePath& path);
84 86
85 // Create a CreateRegKeyWorkItem that creates a registry key at the given 87 // Create a CreateRegKeyWorkItem that creates a registry key at the given
86 // path. 88 // path.
87 static CreateRegKeyWorkItem* CreateCreateRegKeyWorkItem( 89 static CreateRegKeyWorkItem* CreateCreateRegKeyWorkItem(
88 HKEY predefined_root, const std::wstring& path); 90 HKEY predefined_root, const string16& path);
89 91
90 // Create a DeleteRegKeyWorkItem that deletes a registry key at the given 92 // Create a DeleteRegKeyWorkItem that deletes a registry key at the given
91 // path. 93 // path.
92 static DeleteRegKeyWorkItem* CreateDeleteRegKeyWorkItem( 94 static DeleteRegKeyWorkItem* CreateDeleteRegKeyWorkItem(
93 HKEY predefined_root, const std::wstring& path); 95 HKEY predefined_root, const string16& path);
94 96
95 // Create a DeleteRegValueWorkItem that deletes a registry value 97 // Create a DeleteRegValueWorkItem that deletes a registry value
96 static DeleteRegValueWorkItem* CreateDeleteRegValueWorkItem( 98 static DeleteRegValueWorkItem* CreateDeleteRegValueWorkItem(
97 HKEY predefined_root, 99 HKEY predefined_root,
98 const std::wstring& key_path, 100 const string16& key_path,
99 const std::wstring& value_name); 101 const string16& value_name);
100 102
101 // Create a DeleteTreeWorkItem that recursively deletes a file system 103 // Create a DeleteTreeWorkItem that recursively deletes a file system
102 // hierarchy at the given root path. A key file can be optionally specified 104 // hierarchy at the given root path. A key file can be optionally specified
103 // by key_path. 105 // by key_path.
104 static DeleteTreeWorkItem* CreateDeleteTreeWorkItem( 106 static DeleteTreeWorkItem* CreateDeleteTreeWorkItem(
105 const FilePath& root_path, 107 const FilePath& root_path,
106 const FilePath& temp_path, 108 const FilePath& temp_path,
107 const std::vector<FilePath>& key_paths); 109 const std::vector<FilePath>& key_paths);
108 110
111 // Create a FileFromTemplateWorkItem that extracts a template from
112 // |source_path| and writes the resulting file to |dest_path|.
113 static FileFromTemplateWorkItem* CreateFileFromTemplateWorkItem(
114 const FilePath& source_path,
115 const FilePath& dest_path,
116 const FilePath& temp_dir,
117 const std::map<string16, string16>& mappings);
118
109 // Create a MoveTreeWorkItem that recursively moves a file system hierarchy 119 // Create a MoveTreeWorkItem that recursively moves a file system hierarchy
110 // from source path to destination path. 120 // from source path to destination path.
111 static MoveTreeWorkItem* CreateMoveTreeWorkItem( 121 static MoveTreeWorkItem* CreateMoveTreeWorkItem(
112 const FilePath& source_path, 122 const FilePath& source_path,
113 const FilePath& dest_path, 123 const FilePath& dest_path,
114 const FilePath& temp_dir, 124 const FilePath& temp_dir,
115 MoveTreeOption duplicate_option); 125 MoveTreeOption duplicate_option);
116 126
117 // Create a SetRegValueWorkItem that sets a registry value with REG_SZ type 127 // Create a SetRegValueWorkItem that sets a registry value with REG_SZ type
118 // at the key with specified path. 128 // at the key with specified path.
119 static SetRegValueWorkItem* CreateSetRegValueWorkItem( 129 static SetRegValueWorkItem* CreateSetRegValueWorkItem(
120 HKEY predefined_root, 130 HKEY predefined_root,
121 const std::wstring& key_path, 131 const string16& key_path,
122 const std::wstring& value_name, 132 const string16& value_name,
123 const std::wstring& value_data, 133 const string16& value_data,
124 bool overwrite); 134 bool overwrite);
125 135
126 // Create a SetRegValueWorkItem that sets a registry value with REG_DWORD type 136 // Create a SetRegValueWorkItem that sets a registry value with REG_DWORD type
127 // at the key with specified path. 137 // at the key with specified path.
128 static SetRegValueWorkItem* CreateSetRegValueWorkItem( 138 static SetRegValueWorkItem* CreateSetRegValueWorkItem(
129 HKEY predefined_root, 139 HKEY predefined_root,
130 const std::wstring& key_path, 140 const string16& key_path,
131 const std::wstring& value_name, 141 const string16& value_name,
132 DWORD value_data, bool overwrite); 142 DWORD value_data, bool overwrite);
133 143
134 // Create a SetRegValueWorkItem that sets a registry value with REG_QWORD type 144 // Create a SetRegValueWorkItem that sets a registry value with REG_QWORD type
135 // at the key with specified path. 145 // at the key with specified path.
136 static SetRegValueWorkItem* CreateSetRegValueWorkItem( 146 static SetRegValueWorkItem* CreateSetRegValueWorkItem(
137 HKEY predefined_root, 147 HKEY predefined_root,
138 const std::wstring& key_path, 148 const string16& key_path,
139 const std::wstring& value_name, 149 const string16& value_name,
140 int64 value_data, bool overwrite); 150 int64 value_data, bool overwrite);
141 151
142 // Add a SelfRegWorkItem that registers or unregisters a DLL at the 152 // Add a SelfRegWorkItem that registers or unregisters a DLL at the
143 // specified path. 153 // specified path.
144 static SelfRegWorkItem* CreateSelfRegWorkItem(const std::wstring& dll_path, 154 static SelfRegWorkItem* CreateSelfRegWorkItem(const string16& dll_path,
145 bool do_register, 155 bool do_register,
146 bool user_level_registration); 156 bool user_level_registration);
147 157
148 // Create an empty WorkItemList. A WorkItemList can recursively contains 158 // Create an empty WorkItemList. A WorkItemList can recursively contains
149 // a list of WorkItems. 159 // a list of WorkItems.
150 static WorkItemList* CreateWorkItemList(); 160 static WorkItemList* CreateWorkItemList();
151 161
152 // Create an empty WorkItemList that cannot be rolled back. 162 // Create an empty WorkItemList that cannot be rolled back.
153 // Such a work item list executes all items on a best effort basis and does 163 // Such a work item list executes all items on a best effort basis and does
154 // not abort execution if an item in the list fails. 164 // not abort execution if an item in the list fails.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 WorkItem(); 200 WorkItem();
191 201
192 // Specifies whether this work item my fail to complete and yet still 202 // Specifies whether this work item my fail to complete and yet still
193 // return true from Do(). 203 // return true from Do().
194 bool ignore_failure_; 204 bool ignore_failure_;
195 205
196 std::string log_message_; 206 std::string log_message_;
197 }; 207 };
198 208
199 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_ 209 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698