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

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

Issue 6153003: Refactor install.cc into the work item parts and the non-work item parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: PostMergeTest3AddingMissingFile Created 9 years, 11 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
« no previous file with comments | « chrome/installer/util/installer_state.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ 5 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_
6 #define CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ 6 #define CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <windows.h> 9 #include <windows.h>
10 10
(...skipping 17 matching lines...) Expand all
28 // Execute the WorkItems in the same order as they are added to the list. 28 // Execute the WorkItems in the same order as they are added to the list.
29 // It aborts as soon as one WorkItem fails. 29 // It aborts as soon as one WorkItem fails.
30 virtual bool Do(); 30 virtual bool Do();
31 31
32 // Rollback the WorkItems in the reverse order as they are executed. 32 // Rollback the WorkItems in the reverse order as they are executed.
33 virtual void Rollback(); 33 virtual void Rollback();
34 34
35 // Add a WorkItem to the list. 35 // Add a WorkItem to the list.
36 // A WorkItem can only be added to the list before the list's DO() is called. 36 // A WorkItem can only be added to the list before the list's DO() is called.
37 // Once a WorkItem is added to the list. The list owns the WorkItem. 37 // Once a WorkItem is added to the list. The list owns the WorkItem.
38 void AddWorkItem(WorkItem* work_item); 38 virtual void AddWorkItem(WorkItem* work_item);
39 39
40 // Add a CopyTreeWorkItem to the list of work items. 40 // Add a CopyTreeWorkItem to the list of work items.
41 WorkItem* AddCopyTreeWorkItem(const std::wstring& source_path, 41 virtual WorkItem* AddCopyTreeWorkItem(
42 const std::wstring& dest_path, 42 const std::wstring& source_path,
43 const std::wstring& temp_dir, 43 const std::wstring& dest_path,
44 CopyOverWriteOption overwrite_option, 44 const std::wstring& temp_dir,
45 const std::wstring& alternative_path = L""); 45 CopyOverWriteOption overwrite_option,
46 const std::wstring& alternative_path = L"");
46 47
47 // Add a CreateDirWorkItem that creates a directory at the given path. 48 // Add a CreateDirWorkItem that creates a directory at the given path.
48 WorkItem* AddCreateDirWorkItem(const FilePath& path); 49 virtual WorkItem* AddCreateDirWorkItem(const FilePath& path);
49 50
50 // Add a CreateRegKeyWorkItem that creates a registry key at the given 51 // Add a CreateRegKeyWorkItem that creates a registry key at the given
51 // path. 52 // path.
52 WorkItem* AddCreateRegKeyWorkItem(HKEY predefined_root, 53 virtual WorkItem* AddCreateRegKeyWorkItem(HKEY predefined_root,
53 const std::wstring& path); 54 const std::wstring& path);
54 55
55 // Add a DeleteRegKeyWorkItem that deletes a registry key from the given 56 // Add a DeleteRegKeyWorkItem that deletes a registry key from the given
56 // path. 57 // path.
57 WorkItem* AddDeleteRegKeyWorkItem(HKEY predefined_root, 58 virtual WorkItem* AddDeleteRegKeyWorkItem(HKEY predefined_root,
58 const std::wstring& path); 59 const std::wstring& path);
59 60
60 // Add a DeleteRegValueWorkItem that deletes registry value of type REG_SZ 61 // Add a DeleteRegValueWorkItem that deletes registry value of type REG_SZ
61 // or REG_DWORD. 62 // or REG_DWORD.
62 WorkItem* AddDeleteRegValueWorkItem(HKEY predefined_root, 63 virtual WorkItem* AddDeleteRegValueWorkItem(HKEY predefined_root,
63 const std::wstring& key_path, 64 const std::wstring& key_path,
64 const std::wstring& value_name, 65 const std::wstring& value_name,
65 DWORD type); 66 DWORD type);
66 67
67 // Add a DeleteTreeWorkItem that recursively deletes a file system 68 // Add a DeleteTreeWorkItem that recursively deletes a file system
68 // hierarchy at the given root path. A key file can be optionally specified 69 // hierarchy at the given root path. A key file can be optionally specified
69 // by key_path. 70 // by key_path.
70 WorkItem* AddDeleteTreeWorkItem(const FilePath& root_path, 71 virtual WorkItem* AddDeleteTreeWorkItem(
71 const std::vector<FilePath>& key_paths); 72 const FilePath& root_path,
73 const std::vector<FilePath>& key_paths);
72 74
73 // Same as above but without support for key files. 75 // Same as above but without support for key files.
74 WorkItem* AddDeleteTreeWorkItem(const FilePath& root_path); 76 virtual WorkItem* AddDeleteTreeWorkItem(const FilePath& root_path);
75 77
76 // Add a MoveTreeWorkItem to the list of work items. 78 // Add a MoveTreeWorkItem to the list of work items.
77 WorkItem* AddMoveTreeWorkItem(const std::wstring& source_path, 79 virtual WorkItem* AddMoveTreeWorkItem(const std::wstring& source_path,
78 const std::wstring& dest_path, 80 const std::wstring& dest_path,
79 const std::wstring& temp_dir); 81 const std::wstring& temp_dir);
80 82
81 // Add a SetRegValueWorkItem that sets a registry value with REG_SZ type 83 // Add a SetRegValueWorkItem that sets a registry value with REG_SZ type
82 // at the key with specified path. 84 // at the key with specified path.
83 WorkItem* AddSetRegValueWorkItem(HKEY predefined_root, 85 virtual WorkItem* AddSetRegValueWorkItem(HKEY predefined_root,
84 const std::wstring& key_path, 86 const std::wstring& key_path,
85 const std::wstring& value_name, 87 const std::wstring& value_name,
86 const std::wstring& value_data, 88 const std::wstring& value_data,
87 bool overwrite); 89 bool overwrite);
88 90
89 // Add a SetRegValueWorkItem that sets a registry value with REG_DWORD type 91 // Add a SetRegValueWorkItem that sets a registry value with REG_DWORD type
90 // at the key with specified path. 92 // at the key with specified path.
91 WorkItem* AddSetRegValueWorkItem(HKEY predefined_root, 93 virtual WorkItem* AddSetRegValueWorkItem(HKEY predefined_root,
92 const std::wstring& key_path, 94 const std::wstring& key_path,
93 const std::wstring& value_name, 95 const std::wstring& value_name,
94 DWORD value_data, 96 DWORD value_data,
95 bool overwrite); 97 bool overwrite);
96 98
97 // Add a SetRegValueWorkItem that sets a registry value with REG_QWORD type 99 // Add a SetRegValueWorkItem that sets a registry value with REG_QWORD type
98 // at the key with specified path. 100 // at the key with specified path.
99 WorkItem* AddSetRegValueWorkItem(HKEY predefined_root, 101 WorkItem* AddSetRegValueWorkItem(HKEY predefined_root,
100 const std::wstring& key_path, 102 const std::wstring& key_path,
101 const std::wstring& value_name, 103 const std::wstring& value_name,
102 int64 value_data, 104 int64 value_data,
103 bool overwrite); 105 bool overwrite);
104 106
105 // Add a SelfRegWorkItem that registers or unregisters a DLL at the 107 // Add a SelfRegWorkItem that registers or unregisters a DLL at the
106 // specified path. If user_level_registration is true, then alternate 108 // specified path. If user_level_registration is true, then alternate
107 // registration and unregistration entry point names will be used. 109 // registration and unregistration entry point names will be used.
108 WorkItem* AddSelfRegWorkItem(const std::wstring& dll_path, 110 virtual WorkItem* AddSelfRegWorkItem(const std::wstring& dll_path,
109 bool do_register, 111 bool do_register,
110 bool user_level_registration); 112 bool user_level_registration);
111 113
112 protected: 114 protected:
113 friend class WorkItem; 115 friend class WorkItem;
114 116
115 typedef std::list<WorkItem*> WorkItems; 117 typedef std::list<WorkItem*> WorkItems;
116 typedef WorkItems::iterator WorkItemIterator; 118 typedef WorkItems::iterator WorkItemIterator;
117 119
118 enum ListStatus { 120 enum ListStatus {
119 // List has not been executed. Ok to add new WorkItem. 121 // List has not been executed. Ok to add new WorkItem.
120 ADD_ITEM, 122 ADD_ITEM,
(...skipping 26 matching lines...) Expand all
147 // Execute the WorkItems in the same order as they are added to the list. 149 // Execute the WorkItems in the same order as they are added to the list.
148 // If a WorkItem fails, the function will return failure but all other 150 // If a WorkItem fails, the function will return failure but all other
149 // WorkItems will still be executed. 151 // WorkItems will still be executed.
150 virtual bool Do(); 152 virtual bool Do();
151 153
152 // Just does a NOTREACHED. 154 // Just does a NOTREACHED.
153 virtual void Rollback(); 155 virtual void Rollback();
154 }; 156 };
155 157
156 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ 158 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_
OLDNEW
« no previous file with comments | « chrome/installer/util/installer_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698