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

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

Issue 13949011: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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) 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/sandboxed_unpacker.h" 5 #include "chrome/browser/extensions/sandboxed_unpacker.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 new ChromeUtilityMsg_UnpackExtension( 337 new ChromeUtilityMsg_UnpackExtension(
338 temp_crx_path, extension_id_, location_, creation_flags_)); 338 temp_crx_path, extension_id_, location_, creation_flags_));
339 } 339 }
340 340
341 void SandboxedUnpacker::OnUnpackExtensionSucceeded( 341 void SandboxedUnpacker::OnUnpackExtensionSucceeded(
342 const DictionaryValue& manifest) { 342 const DictionaryValue& manifest) {
343 CHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); 343 CHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread());
344 got_response_ = true; 344 got_response_ = true;
345 345
346 scoped_ptr<DictionaryValue> final_manifest(RewriteManifestFile(manifest)); 346 scoped_ptr<DictionaryValue> final_manifest(RewriteManifestFile(manifest));
347 if (!final_manifest.get()) 347 if (!final_manifest)
348 return; 348 return;
349 349
350 // Create an extension object that refers to the temporary location the 350 // Create an extension object that refers to the temporary location the
351 // extension was unpacked to. We use this until the extension is finally 351 // extension was unpacked to. We use this until the extension is finally
352 // installed. For example, the install UI shows images from inside the 352 // installed. For example, the install UI shows images from inside the
353 // extension. 353 // extension.
354 354
355 // Localize manifest now, so confirm UI gets correct extension name. 355 // Localize manifest now, so confirm UI gets correct extension name.
356 356
357 // TODO(rdevlin.cronin): Continue removing std::string errors and replacing 357 // TODO(rdevlin.cronin): Continue removing std::string errors and replacing
(...skipping 11 matching lines...) Expand all
369 } 369 }
370 370
371 extension_ = Extension::Create( 371 extension_ = Extension::Create(
372 extension_root_, 372 extension_root_,
373 location_, 373 location_,
374 *final_manifest, 374 *final_manifest,
375 Extension::REQUIRE_KEY | creation_flags_, 375 Extension::REQUIRE_KEY | creation_flags_,
376 &utf8_error); 376 &utf8_error);
377 377
378 378
379 if (!extension_.get()) { 379 if (!extension_) {
380 ReportFailure( 380 ReportFailure(
381 INVALID_MANIFEST, 381 INVALID_MANIFEST,
382 ASCIIToUTF16("Manifest is invalid: " + utf8_error)); 382 ASCIIToUTF16("Manifest is invalid: " + utf8_error));
383 return; 383 return;
384 } 384 }
385 385
386 if (!RewriteImageFiles()) 386 if (!RewriteImageFiles())
387 return; 387 return;
388 388
389 if (!RewriteCatalogFiles()) 389 if (!RewriteCatalogFiles())
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 ReportFailure( 444 ReportFailure(
445 CRX_HEADER_INVALID, 445 CRX_HEADER_INVALID,
446 l10n_util::GetStringFUTF16( 446 l10n_util::GetStringFUTF16(
447 IDS_EXTENSION_PACKAGE_ERROR_CODE, 447 IDS_EXTENSION_PACKAGE_ERROR_CODE,
448 ASCIIToUTF16("CRX_HEADER_INVALID"))); 448 ASCIIToUTF16("CRX_HEADER_INVALID")));
449 return false; 449 return false;
450 } 450 }
451 451
452 CrxFile::Error error; 452 CrxFile::Error error;
453 scoped_ptr<CrxFile> crx(CrxFile::Parse(header, &error)); 453 scoped_ptr<CrxFile> crx(CrxFile::Parse(header, &error));
454 if (!crx.get()) { 454 if (!crx) {
455 switch (error) { 455 switch (error) {
456 case CrxFile::kWrongMagic: 456 case CrxFile::kWrongMagic:
457 ReportFailure( 457 ReportFailure(
458 CRX_MAGIC_NUMBER_INVALID, 458 CRX_MAGIC_NUMBER_INVALID,
459 l10n_util::GetStringFUTF16( 459 l10n_util::GetStringFUTF16(
460 IDS_EXTENSION_PACKAGE_ERROR_CODE, 460 IDS_EXTENSION_PACKAGE_ERROR_CODE,
461 ASCIIToUTF16("CRX_MAGIC_NUMBER_INVALID"))); 461 ASCIIToUTF16("CRX_MAGIC_NUMBER_INVALID")));
462 break; 462 break;
463 case CrxFile::kInvalidVersion: 463 case CrxFile::kInvalidVersion:
464 // Bad version numer 464 // Bad version numer
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 795
796 void SandboxedUnpacker::Cleanup() { 796 void SandboxedUnpacker::Cleanup() {
797 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); 797 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread());
798 if (!temp_dir_.Delete()) { 798 if (!temp_dir_.Delete()) {
799 LOG(WARNING) << "Can not delete temp directory at " 799 LOG(WARNING) << "Can not delete temp directory at "
800 << temp_dir_.path().value(); 800 << temp_dir_.path().value();
801 } 801 }
802 } 802 }
803 803
804 } // namespace extensions 804 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/requirements_checker.cc ('k') | chrome/browser/extensions/startup_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698