| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "shlwapi.h" | 5 #include "shlwapi.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/registry.h" | 8 #include "base/registry.h" |
| 9 #include "chrome/installer/util/create_reg_key_work_item.h" | 9 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 10 #include "chrome/installer/util/install_util.h" | 10 #include "chrome/installer/util/install_util.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 RegKey key; | 46 RegKey key; |
| 47 std::wstring key_path; | 47 std::wstring key_path; |
| 48 | 48 |
| 49 // To create keys, we iterate from back to front. | 49 // To create keys, we iterate from back to front. |
| 50 for (size_t i = key_list_.size(); i > 0; i--) { | 50 for (size_t i = key_list_.size(); i > 0; i--) { |
| 51 DWORD disposition; | 51 DWORD disposition; |
| 52 key_path.assign(key_list_[i - 1]); | 52 key_path.assign(key_list_[i - 1]); |
| 53 | 53 |
| 54 if (key.CreateWithDisposition(predefined_root_, key_path.c_str(), | 54 if (key.CreateWithDisposition(predefined_root_, key_path.c_str(), |
| 55 &disposition)) { | 55 &disposition, KEY_READ)) { |
| 56 if (disposition == REG_OPENED_EXISTING_KEY) { | 56 if (disposition == REG_OPENED_EXISTING_KEY) { |
| 57 if (key_created_) { | 57 if (key_created_) { |
| 58 // This should not happen. Someone created a subkey under the key | 58 // This should not happen. Someone created a subkey under the key |
| 59 // we just created? | 59 // we just created? |
| 60 LOG(ERROR) << key_path << " exists, this is not expected."; | 60 LOG(ERROR) << key_path << " exists, this is not expected."; |
| 61 return false; | 61 return false; |
| 62 } | 62 } |
| 63 LOG(INFO) << key_path << " exists"; | 63 LOG(INFO) << key_path << " exists"; |
| 64 // Remove the key path from list if it is already present. | 64 // Remove the key path from list if it is already present. |
| 65 key_list_.pop_back(); | 65 key_list_.pop_back(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 do { | 113 do { |
| 114 key_list_.push_back(key_path); | 114 key_list_.push_back(key_path); |
| 115 // This is pure string operation so it does not matter whether the | 115 // This is pure string operation so it does not matter whether the |
| 116 // path is file path or registry path. | 116 // path is file path or registry path. |
| 117 UpOneDirectoryOrEmpty(&key_path); | 117 UpOneDirectoryOrEmpty(&key_path); |
| 118 } while (!key_path.empty()); | 118 } while (!key_path.empty()); |
| 119 | 119 |
| 120 return true; | 120 return true; |
| 121 } | 121 } |
| OLD | NEW |