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

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

Issue 6324004: Made return types of various Value::DeepCopy() implementations more specific (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test for covariant return types Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/sandboxed_extension_unpacker.h" 5 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 // Client takes ownership of temporary directory and extension. 318 // Client takes ownership of temporary directory and extension.
319 client_->OnUnpackSuccess(temp_dir_.Take(), extension_root_, extension_); 319 client_->OnUnpackSuccess(temp_dir_.Take(), extension_root_, extension_);
320 extension_ = NULL; 320 extension_ = NULL;
321 } 321 }
322 322
323 DictionaryValue* SandboxedExtensionUnpacker::RewriteManifestFile( 323 DictionaryValue* SandboxedExtensionUnpacker::RewriteManifestFile(
324 const DictionaryValue& manifest) { 324 const DictionaryValue& manifest) {
325 // Add the public key extracted earlier to the parsed manifest and overwrite 325 // Add the public key extracted earlier to the parsed manifest and overwrite
326 // the original manifest. We do this to ensure the manifest doesn't contain an 326 // the original manifest. We do this to ensure the manifest doesn't contain an
327 // exploitable bug that could be used to compromise the browser. 327 // exploitable bug that could be used to compromise the browser.
328 scoped_ptr<DictionaryValue> final_manifest( 328 scoped_ptr<DictionaryValue> final_manifest(manifest.DeepCopy());
329 static_cast<DictionaryValue*>(manifest.DeepCopy()));
330 final_manifest->SetString(extension_manifest_keys::kPublicKey, public_key_); 329 final_manifest->SetString(extension_manifest_keys::kPublicKey, public_key_);
331 330
332 std::string manifest_json; 331 std::string manifest_json;
333 JSONStringValueSerializer serializer(&manifest_json); 332 JSONStringValueSerializer serializer(&manifest_json);
334 serializer.set_pretty_print(true); 333 serializer.set_pretty_print(true);
335 if (!serializer.Serialize(*final_manifest)) { 334 if (!serializer.Serialize(*final_manifest)) {
336 // Error serializing manifest.json. 335 // Error serializing manifest.json.
337 ReportFailure(l10n_util::GetStringFUTF8( 336 ReportFailure(l10n_util::GetStringFUTF8(
338 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, 337 IDS_EXTENSION_PACKAGE_INSTALL_ERROR,
339 ASCIIToUTF16("ERROR_SERIALIZING_MANIFEST_JSON"))); 338 ASCIIToUTF16("ERROR_SERIALIZING_MANIFEST_JSON")));
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 // Error saving catalog. 489 // Error saving catalog.
491 ReportFailure(l10n_util::GetStringFUTF8( 490 ReportFailure(l10n_util::GetStringFUTF8(
492 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, 491 IDS_EXTENSION_PACKAGE_INSTALL_ERROR,
493 ASCIIToUTF16("ERROR_SAVING_CATALOG"))); 492 ASCIIToUTF16("ERROR_SAVING_CATALOG")));
494 return false; 493 return false;
495 } 494 }
496 } 495 }
497 496
498 return true; 497 return true;
499 } 498 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_pref_extension_loader.cc ('k') | chrome/browser/importer/importer_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698