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_pref_extension_provider.h" | 5 #include "chrome/browser/extensions/external_pref_extension_provider.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/version.h" | 9 #include "base/version.h" |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 scoped_ptr<Version> version; | 59 scoped_ptr<Version> version; |
60 version.reset(Version::GetVersionFromString(external_version)); | 60 version.reset(Version::GetVersionFromString(external_version)); |
61 visitor->OnExternalExtensionFound( | 61 visitor->OnExternalExtensionFound( |
62 WideToASCII(extension_id), version.get(), FilePath(external_crx)); | 62 WideToASCII(extension_id), version.get(), FilePath(external_crx)); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 Version* ExternalPrefExtensionProvider::RegisteredVersion( | 66 Version* ExternalPrefExtensionProvider::RegisteredVersion( |
67 std::string id, Extension::Location* location) const { | 67 std::string id, Extension::Location* location) const { |
68 DictionaryValue* extension = NULL; | 68 DictionaryValue* extension = NULL; |
69 if (!prefs_->GetDictionary(ASCIIToWide(id), &extension)) { | 69 if (!prefs_->GetDictionary(ASCIIToWide(id), &extension)) |
70 NOTREACHED() << "Cannot read extension " << id.c_str() | |
71 << " from dictionary."; | |
72 return NULL; | 70 return NULL; |
73 } | |
74 | 71 |
75 std::string external_version; | 72 std::string external_version; |
76 if (!extension->GetString(kExternalVersion, &external_version)) | 73 if (!extension->GetString(kExternalVersion, &external_version)) |
77 return NULL; | 74 return NULL; |
78 | 75 |
79 if (location) | 76 if (location) |
80 *location = Extension::EXTERNAL_PREF; | 77 *location = Extension::EXTERNAL_PREF; |
81 return Version::GetVersionFromString(external_version); | 78 return Version::GetVersionFromString(external_version); |
82 } | 79 } |
OLD | NEW |