OLD | NEW |
1 // Copyright (c) 2009 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 #include "chrome/browser/extensions/external_registry_extension_provider_win.h" | 5 #include "chrome/browser/extensions/external_registry_extension_provider_win.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/registry.h" | 8 #include "base/registry.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 void ExternalRegistryExtensionProvider::VisitRegisteredExtension( | 31 void ExternalRegistryExtensionProvider::VisitRegisteredExtension( |
32 Visitor* visitor, const std::set<std::string>& ids_to_ignore) const { | 32 Visitor* visitor, const std::set<std::string>& ids_to_ignore) const { |
33 RegistryKeyIterator iterator(kRegRoot, | 33 RegistryKeyIterator iterator(kRegRoot, |
34 ASCIIToWide(kRegistryExtensions).c_str()); | 34 ASCIIToWide(kRegistryExtensions).c_str()); |
35 while (iterator.Valid()) { | 35 while (iterator.Valid()) { |
36 RegKey key; | 36 RegKey key; |
37 std::wstring key_path = ASCIIToWide(kRegistryExtensions); | 37 std::wstring key_path = ASCIIToWide(kRegistryExtensions); |
38 key_path.append(L"\\"); | 38 key_path.append(L"\\"); |
39 key_path.append(iterator.Name()); | 39 key_path.append(iterator.Name()); |
40 if (key.Open(kRegRoot, key_path.c_str(), KEY_READ)) { | 40 if (key.Open(kRegRoot, key_path.c_str())) { |
41 std::wstring extension_path; | 41 std::wstring extension_path; |
42 if (key.ReadValue(kRegistryExtensionPath, &extension_path)) { | 42 if (key.ReadValue(kRegistryExtensionPath, &extension_path)) { |
43 std::wstring extension_version; | 43 std::wstring extension_version; |
44 if (key.ReadValue(kRegistryExtensionVersion, &extension_version)) { | 44 if (key.ReadValue(kRegistryExtensionVersion, &extension_version)) { |
45 std::string id = WideToASCII(iterator.Name()); | 45 std::string id = WideToASCII(iterator.Name()); |
46 StringToLowerASCII(&id); | 46 StringToLowerASCII(&id); |
47 if (ids_to_ignore.find(id) != ids_to_ignore.end()) { | 47 if (ids_to_ignore.find(id) != ids_to_ignore.end()) { |
48 ++iterator; | 48 ++iterator; |
49 continue; | 49 continue; |
50 } | 50 } |
(...skipping 19 matching lines...) Expand all Loading... |
70 } | 70 } |
71 | 71 |
72 Version* ExternalRegistryExtensionProvider::RegisteredVersion( | 72 Version* ExternalRegistryExtensionProvider::RegisteredVersion( |
73 const std::string& id, | 73 const std::string& id, |
74 Extension::Location* location) const { | 74 Extension::Location* location) const { |
75 RegKey key; | 75 RegKey key; |
76 std::wstring key_path = ASCIIToWide(kRegistryExtensions); | 76 std::wstring key_path = ASCIIToWide(kRegistryExtensions); |
77 key_path.append(L"\\"); | 77 key_path.append(L"\\"); |
78 key_path.append(ASCIIToWide(id)); | 78 key_path.append(ASCIIToWide(id)); |
79 | 79 |
80 if (!key.Open(kRegRoot, key_path.c_str(), KEY_READ)) | 80 if (!key.Open(kRegRoot, key_path.c_str())) |
81 return NULL; | 81 return NULL; |
82 | 82 |
83 std::wstring extension_version; | 83 std::wstring extension_version; |
84 if (!key.ReadValue(kRegistryExtensionVersion, &extension_version)) | 84 if (!key.ReadValue(kRegistryExtensionVersion, &extension_version)) |
85 return NULL; | 85 return NULL; |
86 | 86 |
87 if (location) | 87 if (location) |
88 *location = Extension::EXTERNAL_REGISTRY; | 88 *location = Extension::EXTERNAL_REGISTRY; |
89 return Version::GetVersionFromString(extension_version); | 89 return Version::GetVersionFromString(extension_version); |
90 } | 90 } |
OLD | NEW |