OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/component_loader.h" | 5 #include "chrome/browser/extensions/component_loader.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 namespace extensions { | 78 namespace extensions { |
79 | 79 |
80 namespace { | 80 namespace { |
81 | 81 |
82 static bool enable_background_extensions_during_testing = false; | 82 static bool enable_background_extensions_during_testing = false; |
83 | 83 |
84 std::string GenerateId(const base::DictionaryValue* manifest, | 84 std::string GenerateId(const base::DictionaryValue* manifest, |
85 const base::FilePath& path) { | 85 const base::FilePath& path) { |
86 std::string raw_key; | 86 std::string raw_key; |
87 std::string id_input; | 87 std::string id_input; |
88 CHECK(manifest->GetString(manifest_keys::kPublicKey, &raw_key)); | 88 if (!manifest->GetString(manifest_keys::kPublicKey, &raw_key)) { |
| 89 LOG(ERROR) << "No PublicKey property for: " << path.value(); |
| 90 return ""; |
| 91 } |
89 CHECK(Extension::ParsePEMKeyBytes(raw_key, &id_input)); | 92 CHECK(Extension::ParsePEMKeyBytes(raw_key, &id_input)); |
90 std::string id = crx_file::id_util::GenerateId(id_input); | 93 std::string id = crx_file::id_util::GenerateId(id_input); |
91 return id; | 94 return id; |
92 } | 95 } |
93 | 96 |
94 #if defined(OS_CHROMEOS) | 97 #if defined(OS_CHROMEOS) |
95 scoped_ptr<base::DictionaryValue> | 98 scoped_ptr<base::DictionaryValue> |
96 LoadManifestOnFileThread( | 99 LoadManifestOnFileThread( |
97 const base::FilePath& root_directory, | 100 const base::FilePath& root_directory, |
98 const base::FilePath::CharType* manifest_filename) { | 101 const base::FilePath::CharType* manifest_filename) { |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 const char* extension_id, | 785 const char* extension_id, |
783 const base::Closure& done_cb, | 786 const base::Closure& done_cb, |
784 scoped_ptr<base::DictionaryValue> manifest) { | 787 scoped_ptr<base::DictionaryValue> manifest) { |
785 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 788 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
786 if (!manifest) | 789 if (!manifest) |
787 return; // Error already logged. | 790 return; // Error already logged. |
788 std::string actual_extension_id = Add( | 791 std::string actual_extension_id = Add( |
789 manifest.release(), | 792 manifest.release(), |
790 root_directory, | 793 root_directory, |
791 false); | 794 false); |
792 CHECK_EQ(extension_id, actual_extension_id); | 795 DCHECK_EQ(extension_id, actual_extension_id); |
793 if (!done_cb.is_null()) | 796 if (!done_cb.is_null()) |
794 done_cb.Run(); | 797 done_cb.Run(); |
795 } | 798 } |
796 #endif | 799 #endif |
797 | 800 |
798 } // namespace extensions | 801 } // namespace extensions |
OLD | NEW |