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_loader_win.h" | 5 #include "chrome/browser/extensions/external_registry_extension_loader_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/values.h" | 10 #include "base/values.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 42 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
43 scoped_ptr<DictionaryValue> prefs(new DictionaryValue); | 43 scoped_ptr<DictionaryValue> prefs(new DictionaryValue); |
44 | 44 |
45 base::win::RegistryKeyIterator iterator( | 45 base::win::RegistryKeyIterator iterator( |
46 kRegRoot, ASCIIToWide(kRegistryExtensions).c_str()); | 46 kRegRoot, ASCIIToWide(kRegistryExtensions).c_str()); |
47 while (iterator.Valid()) { | 47 while (iterator.Valid()) { |
48 base::win::RegKey key; | 48 base::win::RegKey key; |
49 std::wstring key_path = ASCIIToWide(kRegistryExtensions); | 49 std::wstring key_path = ASCIIToWide(kRegistryExtensions); |
50 key_path.append(L"\\"); | 50 key_path.append(L"\\"); |
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) == ERROR_SUCCESS) { |
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 == ERROR_SUCCESS) { |
55 std::wstring extension_version; | 56 std::wstring extension_version; |
56 if (key.ReadValue(kRegistryExtensionVersion, &extension_version)) { | 57 if (key.ReadValue(kRegistryExtensionVersion, &extension_version) |
| 58 == ERROR_SUCCESS) { |
57 std::string id = WideToASCII(iterator.Name()); | 59 std::string id = WideToASCII(iterator.Name()); |
58 StringToLowerASCII(&id); | 60 StringToLowerASCII(&id); |
59 | 61 |
60 if (!Extension::IdIsValid(id)) { | 62 if (!Extension::IdIsValid(id)) { |
61 LOG(ERROR) << "Invalid id value " << id | 63 LOG(ERROR) << "Invalid id value " << id |
62 << " for key " << key_path << " ."; | 64 << " for key " << key_path << " ."; |
63 ++iterator; | 65 ++iterator; |
64 continue; | 66 continue; |
65 } | 67 } |
66 | 68 |
(...skipping 27 matching lines...) Expand all Loading... |
94 ++iterator; | 96 ++iterator; |
95 } | 97 } |
96 | 98 |
97 prefs_.reset(prefs.release()); | 99 prefs_.reset(prefs.release()); |
98 BrowserThread::PostTask( | 100 BrowserThread::PostTask( |
99 BrowserThread::UI, FROM_HERE, | 101 BrowserThread::UI, FROM_HERE, |
100 NewRunnableMethod( | 102 NewRunnableMethod( |
101 this, | 103 this, |
102 &ExternalRegistryExtensionLoader::LoadFinished)); | 104 &ExternalRegistryExtensionLoader::LoadFinished)); |
103 } | 105 } |
OLD | NEW |