Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/browser/extensions/external_registry_extension_provider_win.cc

Issue 5535002: Decouple killbit testing from external extension providers (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 23 matching lines...) Expand all
34 34
35 } // namespace 35 } // namespace
36 36
37 ExternalRegistryExtensionProvider::ExternalRegistryExtensionProvider() { 37 ExternalRegistryExtensionProvider::ExternalRegistryExtensionProvider() {
38 } 38 }
39 39
40 ExternalRegistryExtensionProvider::~ExternalRegistryExtensionProvider() { 40 ExternalRegistryExtensionProvider::~ExternalRegistryExtensionProvider() {
41 } 41 }
42 42
43 void ExternalRegistryExtensionProvider::VisitRegisteredExtension( 43 void ExternalRegistryExtensionProvider::VisitRegisteredExtension(
44 Visitor* visitor, const std::set<std::string>& ids_to_ignore) const { 44 Visitor* visitor) const {
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)) {
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 if (ids_to_ignore.find(id) != ids_to_ignore.end()) {
60 ++iterator;
61 continue;
62 }
63 59
64 scoped_ptr<Version> version; 60 scoped_ptr<Version> version;
65 version.reset(Version::GetVersionFromString(extension_version)); 61 version.reset(Version::GetVersionFromString(extension_version));
66 if (!version.get()) { 62 if (!version.get()) {
67 LOG(ERROR) << "Invalid version value " << extension_version 63 LOG(ERROR) << "Invalid version value " << extension_version
68 << " for key " << key_path; 64 << " for key " << key_path;
69 ++iterator; 65 ++iterator;
70 continue; 66 continue;
71 } 67 }
72 68
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 if (!key.ReadValue(kRegistryExtensionVersion, &extension_version)) 103 if (!key.ReadValue(kRegistryExtensionVersion, &extension_version))
108 return false; 104 return false;
109 105
110 if (version) 106 if (version)
111 version->reset(Version::GetVersionFromString(extension_version)); 107 version->reset(Version::GetVersionFromString(extension_version));
112 108
113 if (location) 109 if (location)
114 *location = Extension::EXTERNAL_REGISTRY; 110 *location = Extension::EXTERNAL_REGISTRY;
115 return true; 111 return true;
116 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698