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

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

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 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
OLDNEW
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 for (const auto& component_extension : component_extensions_) 160 for (const auto& component_extension : component_extensions_)
161 Load(component_extension); 161 Load(component_extension);
162 } 162 }
163 163
164 std::unique_ptr<base::DictionaryValue> ComponentLoader::ParseManifest( 164 std::unique_ptr<base::DictionaryValue> ComponentLoader::ParseManifest(
165 base::StringPiece manifest_contents) const { 165 base::StringPiece manifest_contents) const {
166 JSONStringValueDeserializer deserializer(manifest_contents); 166 JSONStringValueDeserializer deserializer(manifest_contents);
167 std::unique_ptr<base::Value> manifest = deserializer.Deserialize(NULL, NULL); 167 std::unique_ptr<base::Value> manifest = deserializer.Deserialize(NULL, NULL);
168 168
169 if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) { 169 if (!manifest.get() || !manifest->IsType(base::Value::Type::DICTIONARY)) {
170 LOG(ERROR) << "Failed to parse extension manifest."; 170 LOG(ERROR) << "Failed to parse extension manifest.";
171 return std::unique_ptr<base::DictionaryValue>(); 171 return std::unique_ptr<base::DictionaryValue>();
172 } 172 }
173 return base::DictionaryValue::From(std::move(manifest)); 173 return base::DictionaryValue::From(std::move(manifest));
174 } 174 }
175 175
176 std::string ComponentLoader::Add(int manifest_resource_id, 176 std::string ComponentLoader::Add(int manifest_resource_id,
177 const base::FilePath& root_directory) { 177 const base::FilePath& root_directory) {
178 if (!ignore_whitelist_for_testing_ && 178 if (!ignore_whitelist_for_testing_ &&
179 !IsComponentExtensionWhitelisted(manifest_resource_id)) 179 !IsComponentExtensionWhitelisted(manifest_resource_id))
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 return; // Error already logged. 684 return; // Error already logged.
685 std::string actual_extension_id = 685 std::string actual_extension_id =
686 Add(std::move(manifest), root_directory, false); 686 Add(std::move(manifest), root_directory, false);
687 CHECK_EQ(extension_id, actual_extension_id); 687 CHECK_EQ(extension_id, actual_extension_id);
688 if (!done_cb.is_null()) 688 if (!done_cb.is_null())
689 done_cb.Run(); 689 done_cb.Run();
690 } 690 }
691 #endif 691 #endif
692 692
693 } // namespace extensions 693 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698