| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_CREATE_REG_KEY_WORK_ITEM_H__ | 5 #ifndef CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H__ |
| 6 #define CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H__ | 6 #define CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include <windows.h> | 11 #include <windows.h> |
| 12 | 12 |
| 13 #include "chrome/installer/util/work_item.h" | 13 #include "chrome/installer/util/work_item.h" |
| 14 | 14 |
| 15 // A WorkItem subclass that creates a registry key at the given path. | 15 // A WorkItem subclass that creates a registry key at the given path. |
| 16 // It also creates all necessary intermediate keys if they do not exist. | 16 // It also creates all necessary intermediate keys if they do not exist. |
| 17 class CreateRegKeyWorkItem : public WorkItem { | 17 class CreateRegKeyWorkItem : public WorkItem { |
| 18 public: | 18 public: |
| 19 virtual ~CreateRegKeyWorkItem(); | 19 virtual ~CreateRegKeyWorkItem(); |
| 20 | 20 |
| 21 virtual bool Do(); | 21 virtual bool Do(); |
| 22 | 22 |
| 23 virtual void Rollback(); | 23 virtual void Rollback(); |
| 24 | 24 |
| 25 private: | 25 private: |
| 26 friend class WorkItem; | 26 friend class WorkItem; |
| 27 | 27 |
| 28 CreateRegKeyWorkItem(HKEY predefined_root, std::wstring path); | 28 CreateRegKeyWorkItem(HKEY predefined_root, const std::wstring& path); |
| 29 | 29 |
| 30 // Initialize key_list_ by adding all paths of keys from predefined_root_ | 30 // Initialize key_list_ by adding all paths of keys from predefined_root_ |
| 31 // to path_. Returns true if key_list_ is non empty. | 31 // to path_. Returns true if key_list_ is non empty. |
| 32 bool InitKeyList(); | 32 bool InitKeyList(); |
| 33 | 33 |
| 34 // Root key under which we create the new key. The root key can only be | 34 // Root key under which we create the new key. The root key can only be |
| 35 // one of the predefined keys on Windows. | 35 // one of the predefined keys on Windows. |
| 36 HKEY predefined_root_; | 36 HKEY predefined_root_; |
| 37 | 37 |
| 38 // Path of the key to be created. | 38 // Path of the key to be created. |
| 39 std::wstring path_; | 39 std::wstring path_; |
| 40 | 40 |
| 41 // List of paths to all keys that need to be created from predefined_root_ | 41 // List of paths to all keys that need to be created from predefined_root_ |
| 42 // to path_. | 42 // to path_. |
| 43 std::vector<std::wstring> key_list_; | 43 std::vector<std::wstring> key_list_; |
| 44 | 44 |
| 45 // Whether any key has been created. | 45 // Whether any key has been created. |
| 46 bool key_created_; | 46 bool key_created_; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 #endif // CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H__ | 49 #endif // CHROME_INSTALLER_UTIL_CREATE_REG_KEY_WORK_ITEM_H__ |
| OLD | NEW |