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

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 comments. 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 component_extensions_.begin(); 138 component_extensions_.begin();
139 it != component_extensions_.end(); ++it) { 139 it != component_extensions_.end(); ++it) {
140 Load(*it); 140 Load(*it);
141 } 141 }
142 UMA_HISTOGRAM_TIMES("Extensions.LoadAllComponentTime", 142 UMA_HISTOGRAM_TIMES("Extensions.LoadAllComponentTime",
143 base::TimeTicks::Now() - start_time); 143 base::TimeTicks::Now() - start_time);
144 } 144 }
145 145
146 base::DictionaryValue* ComponentLoader::ParseManifest( 146 base::DictionaryValue* ComponentLoader::ParseManifest(
147 const std::string& manifest_contents) const { 147 const std::string& manifest_contents) const {
148 JSONStringValueSerializer serializer(manifest_contents); 148 JSONStringValueDeserializer deserializer(manifest_contents);
149 scoped_ptr<base::Value> manifest(serializer.Deserialize(NULL, NULL)); 149 scoped_ptr<base::Value> manifest(deserializer.Deserialize(NULL, NULL));
150 150
151 if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) { 151 if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) {
152 LOG(ERROR) << "Failed to parse extension manifest."; 152 LOG(ERROR) << "Failed to parse extension manifest.";
153 return NULL; 153 return NULL;
154 } 154 }
155 // Transfer ownership to the caller. 155 // Transfer ownership to the caller.
156 return static_cast<base::DictionaryValue*>(manifest.release()); 156 return static_cast<base::DictionaryValue*>(manifest.release());
157 } 157 }
158 158
159 void ComponentLoader::ClearAllRegistered() { 159 void ComponentLoader::ClearAllRegistered() {
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); 673 off_the_record_context, Extension::GetBaseURLFromExtensionId(id));
674 storage::FileSystemContext* file_system_context = 674 storage::FileSystemContext* file_system_context =
675 content::BrowserContext::GetStoragePartitionForSite( 675 content::BrowserContext::GetStoragePartitionForSite(
676 off_the_record_context, site)->GetFileSystemContext(); 676 off_the_record_context, site)->GetFileSystemContext();
677 file_system_context->EnableTemporaryFileSystemInIncognito(); 677 file_system_context->EnableTemporaryFileSystemInIncognito();
678 } 678 }
679 #endif 679 #endif
680 } 680 }
681 681
682 } // namespace extensions 682 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698