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( | 61 version.reset(Version::GetVersionFromString(extension_version)); |
62 WideToASCII(extension_version))); | |
63 if (!version.get()) { | 62 if (!version.get()) { |
64 LOG(ERROR) << "Invalid version value " << extension_version | 63 LOG(ERROR) << "Invalid version value " << extension_version |
65 << " for key " << key_path; | 64 << " for key " << key_path; |
66 ++iterator; | 65 ++iterator; |
67 continue; | 66 continue; |
68 } | 67 } |
69 | 68 |
70 FilePath path = FilePath::FromWStringHack(extension_path); | 69 FilePath path = FilePath::FromWStringHack(extension_path); |
71 visitor->OnExternalExtensionFileFound(id, version.get(), path, | 70 visitor->OnExternalExtensionFileFound(id, version.get(), path, |
72 Extension::EXTERNAL_REGISTRY); | 71 Extension::EXTERNAL_REGISTRY); |
(...skipping 24 matching lines...) Expand all Loading... |
97 Extension::Location* location, | 96 Extension::Location* location, |
98 scoped_ptr<Version>* version) const { | 97 scoped_ptr<Version>* version) const { |
99 base::win::RegKey key; | 98 base::win::RegKey key; |
100 if (!OpenKeyById(id, &key)) | 99 if (!OpenKeyById(id, &key)) |
101 return false; | 100 return false; |
102 | 101 |
103 std::wstring extension_version; | 102 std::wstring extension_version; |
104 if (!key.ReadValue(kRegistryExtensionVersion, &extension_version)) | 103 if (!key.ReadValue(kRegistryExtensionVersion, &extension_version)) |
105 return false; | 104 return false; |
106 | 105 |
107 if (version) { | 106 if (version) |
108 version->reset(Version::GetVersionFromString( | 107 version->reset(Version::GetVersionFromString(extension_version)); |
109 WideToASCII(extension_version))); | |
110 } | |
111 | 108 |
112 if (location) | 109 if (location) |
113 *location = Extension::EXTERNAL_REGISTRY; | 110 *location = Extension::EXTERNAL_REGISTRY; |
114 return true; | 111 return true; |
115 } | 112 } |
OLD | NEW |