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

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

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per review comment. Created 5 years, 10 months 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 component_extensions_.begin(); 131 component_extensions_.begin();
132 it != component_extensions_.end(); ++it) { 132 it != component_extensions_.end(); ++it) {
133 Load(*it); 133 Load(*it);
134 } 134 }
135 UMA_HISTOGRAM_TIMES("Extensions.LoadAllComponentTime", 135 UMA_HISTOGRAM_TIMES("Extensions.LoadAllComponentTime",
136 base::TimeTicks::Now() - start_time); 136 base::TimeTicks::Now() - start_time);
137 } 137 }
138 138
139 base::DictionaryValue* ComponentLoader::ParseManifest( 139 base::DictionaryValue* ComponentLoader::ParseManifest(
140 const std::string& manifest_contents) const { 140 const std::string& manifest_contents) const {
141 JSONStringValueSerializer serializer(manifest_contents); 141 JSONStringValueDeserializer deserializer(manifest_contents);
142 scoped_ptr<base::Value> manifest(serializer.Deserialize(NULL, NULL)); 142 scoped_ptr<base::Value> manifest(deserializer.Deserialize(NULL, NULL));
143 143
144 if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) { 144 if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) {
145 LOG(ERROR) << "Failed to parse extension manifest."; 145 LOG(ERROR) << "Failed to parse extension manifest.";
146 return NULL; 146 return NULL;
147 } 147 }
148 // Transfer ownership to the caller. 148 // Transfer ownership to the caller.
149 return static_cast<base::DictionaryValue*>(manifest.release()); 149 return static_cast<base::DictionaryValue*>(manifest.release());
150 } 150 }
151 151
152 void ComponentLoader::ClearAllRegistered() { 152 void ComponentLoader::ClearAllRegistered() {
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); 660 off_the_record_context, Extension::GetBaseURLFromExtensionId(id));
661 storage::FileSystemContext* file_system_context = 661 storage::FileSystemContext* file_system_context =
662 content::BrowserContext::GetStoragePartitionForSite( 662 content::BrowserContext::GetStoragePartitionForSite(
663 off_the_record_context, site)->GetFileSystemContext(); 663 off_the_record_context, site)->GetFileSystemContext();
664 file_system_context->EnableTemporaryFileSystemInIncognito(); 664 file_system_context->EnableTemporaryFileSystemInIncognito();
665 } 665 }
666 #endif 666 #endif
667 } 667 }
668 668
669 } // namespace extensions 669 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698