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 "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/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/version.h" | 10 #include "base/version.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 key_path.append(iterator.Name()); | 51 key_path.append(iterator.Name()); |
52 if (key.Open(kRegRoot, key_path.c_str(), KEY_READ)) { | 52 if (key.Open(kRegRoot, key_path.c_str(), KEY_READ)) { |
53 std::wstring extension_path; | 53 std::wstring extension_path; |
54 if (key.ReadValue(kRegistryExtensionPath, &extension_path)) { | 54 if (key.ReadValue(kRegistryExtensionPath, &extension_path)) { |
55 std::wstring extension_version; | 55 std::wstring extension_version; |
56 if (key.ReadValue(kRegistryExtensionVersion, &extension_version)) { | 56 if (key.ReadValue(kRegistryExtensionVersion, &extension_version)) { |
57 std::string id = WideToASCII(iterator.Name()); | 57 std::string id = WideToASCII(iterator.Name()); |
58 StringToLowerASCII(&id); | 58 StringToLowerASCII(&id); |
59 | 59 |
60 scoped_ptr<Version> version; | 60 scoped_ptr<Version> version; |
61 version.reset(Version::GetVersionFromString(extension_version)); | 61 version.reset(Version::GetVersionFromString( |
| 62 WideToASCII(extension_version))); |
62 if (!version.get()) { | 63 if (!version.get()) { |
63 LOG(ERROR) << "Invalid version value " << extension_version | 64 LOG(ERROR) << "Invalid version value " << extension_version |
64 << " for key " << key_path; | 65 << " for key " << key_path; |
65 ++iterator; | 66 ++iterator; |
66 continue; | 67 continue; |
67 } | 68 } |
68 | 69 |
69 FilePath path = FilePath::FromWStringHack(extension_path); | 70 FilePath path = FilePath::FromWStringHack(extension_path); |
70 visitor->OnExternalExtensionFileFound(id, version.get(), path, | 71 visitor->OnExternalExtensionFileFound(id, version.get(), path, |
71 Extension::EXTERNAL_REGISTRY); | 72 Extension::EXTERNAL_REGISTRY); |
(...skipping 24 matching lines...) Expand all Loading... |
96 Extension::Location* location, | 97 Extension::Location* location, |
97 scoped_ptr<Version>* version) const { | 98 scoped_ptr<Version>* version) const { |
98 base::win::RegKey key; | 99 base::win::RegKey key; |
99 if (!OpenKeyById(id, &key)) | 100 if (!OpenKeyById(id, &key)) |
100 return false; | 101 return false; |
101 | 102 |
102 std::wstring extension_version; | 103 std::wstring extension_version; |
103 if (!key.ReadValue(kRegistryExtensionVersion, &extension_version)) | 104 if (!key.ReadValue(kRegistryExtensionVersion, &extension_version)) |
104 return false; | 105 return false; |
105 | 106 |
106 if (version) | 107 if (version) { |
107 version->reset(Version::GetVersionFromString(extension_version)); | 108 version->reset(Version::GetVersionFromString( |
| 109 WideToASCII(extension_version))); |
| 110 } |
108 | 111 |
109 if (location) | 112 if (location) |
110 *location = Extension::EXTERNAL_REGISTRY; | 113 *location = Extension::EXTERNAL_REGISTRY; |
111 return true; | 114 return true; |
112 } | 115 } |
OLD | NEW |