Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "chrome/installer/util/app_commands.h" | 5 #include "chrome/installer/util/app_commands.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/win/registry.h" | 8 #include "base/win/registry.h" |
| 9 #include "chrome/installer/util/google_update_constants.h" | 9 #include "chrome/installer/util/google_update_constants.h" |
| 10 #include "chrome/installer/util/work_item_list.h" | 10 #include "chrome/installer/util/work_item_list.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 } | 26 } |
| 27 | 27 |
| 28 using base::win::RegistryKeyIterator; | 28 using base::win::RegistryKeyIterator; |
| 29 static const wchar_t kEmptyString[] = L""; | 29 static const wchar_t kEmptyString[] = L""; |
| 30 | 30 |
| 31 commands_.clear(); | 31 commands_.clear(); |
| 32 | 32 |
| 33 RegKey cmd_key; | 33 RegKey cmd_key; |
| 34 LONG result; | 34 LONG result; |
| 35 AppCommand command; | 35 AppCommand command; |
| 36 for (RegistryKeyIterator key_iterator(key.Handle(), kEmptyString); | 36 for (RegistryKeyIterator key_iterator( |
| 37 key_iterator.Valid(); ++key_iterator) { | 37 key.Handle(), kEmptyString, KEY_WOW64_32KEY); |
|
grt (UTC plus 2)
2014/10/01 17:14:30
this is ugly. it so happens that it's correct, but
Will Harris
2014/10/01 17:20:21
yes, and it's not by coincidence, I manually went
grt (UTC plus 2)
2014/10/01 17:33:49
I wish I did. The whys and wherefores for these ma
cpu_(ooo_6.6-7.5)
2014/10/06 19:48:57
you can have as many constructors as you need, in
Will Harris
2014/10/07 02:03:16
Done.
| |
| 38 key_iterator.Valid(); | |
| 39 ++key_iterator) { | |
| 38 const wchar_t* name = key_iterator.Name(); | 40 const wchar_t* name = key_iterator.Name(); |
| 39 result = cmd_key.Open(key.Handle(), name, KEY_QUERY_VALUE); | 41 result = cmd_key.Open(key.Handle(), name, KEY_QUERY_VALUE); |
| 40 if (result != ERROR_SUCCESS) { | 42 if (result != ERROR_SUCCESS) { |
| 41 LOG(ERROR) << "Failed to open key \"" << name | 43 LOG(ERROR) << "Failed to open key \"" << name |
| 42 << "\" with last-error code " << result; | 44 << "\" with last-error code " << result; |
| 43 } else if (command.Initialize(cmd_key)) { | 45 } else if (command.Initialize(cmd_key)) { |
| 44 commands_[name] = command; | 46 commands_[name] = command; |
| 45 } else { | 47 } else { |
| 46 VLOG(1) << "Skipping over key \"" << name | 48 VLOG(1) << "Skipping over key \"" << name |
| 47 << "\" as it does not appear to hold a product command."; | 49 << "\" as it does not appear to hold a product command."; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 | 84 |
| 83 bool AppCommands::Remove(const std::wstring& command_id) { | 85 bool AppCommands::Remove(const std::wstring& command_id) { |
| 84 return commands_.erase(command_id) != 0; | 86 return commands_.erase(command_id) != 0; |
| 85 } | 87 } |
| 86 | 88 |
| 87 AppCommands::CommandMapRange AppCommands::GetIterators() const { | 89 AppCommands::CommandMapRange AppCommands::GetIterators() const { |
| 88 return std::make_pair(commands_.begin(), commands_.end()); | 90 return std::make_pair(commands_.begin(), commands_.end()); |
| 89 } | 91 } |
| 90 | 92 |
| 91 } // namespace installer | 93 } // namespace installer |
| OLD | NEW |