OLD | NEW |
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 "extensions/browser/sandboxed_unpacker.h" | 5 #include "extensions/browser/sandboxed_unpacker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 419 |
420 DCHECK(directory.DirName() == temp_dir_.GetPath()); | 420 DCHECK(directory.DirName() == temp_dir_.GetPath()); |
421 | 421 |
422 utility_process_mojo_client_->service()->Unpack( | 422 utility_process_mojo_client_->service()->Unpack( |
423 directory, extension_id_, location_, creation_flags_, | 423 directory, extension_id_, location_, creation_flags_, |
424 base::Bind(&SandboxedUnpacker::UnpackDone, this)); | 424 base::Bind(&SandboxedUnpacker::UnpackDone, this)); |
425 } | 425 } |
426 | 426 |
427 void SandboxedUnpacker::UnpackDone( | 427 void SandboxedUnpacker::UnpackDone( |
428 const base::string16& error, | 428 const base::string16& error, |
429 std::unique_ptr<base::DictionaryValue> manifest) { | 429 const base::Optional<base::DictionaryValue>& manifest) { |
430 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 430 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
431 | 431 |
432 utility_process_mojo_client_.reset(); | 432 utility_process_mojo_client_.reset(); |
433 | 433 |
434 if (!error.empty()) { | 434 if (!error.empty()) { |
435 unpacker_io_task_runner_->PostTask( | 435 unpacker_io_task_runner_->PostTask( |
436 FROM_HERE, | 436 FROM_HERE, |
437 base::Bind(&SandboxedUnpacker::UnpackExtensionFailed, this, error)); | 437 base::Bind(&SandboxedUnpacker::UnpackExtensionFailed, this, error)); |
438 return; | 438 return; |
439 } | 439 } |
440 | 440 |
441 unpacker_io_task_runner_->PostTask( | 441 unpacker_io_task_runner_->PostTask( |
442 FROM_HERE, base::Bind(&SandboxedUnpacker::UnpackExtensionSucceeded, this, | 442 FROM_HERE, base::Bind(&SandboxedUnpacker::UnpackExtensionSucceeded, this, |
443 base::Passed(&manifest))); | 443 base::Passed(manifest->CreateDeepCopy()))); |
444 } | 444 } |
445 | 445 |
446 void SandboxedUnpacker::UnpackExtensionSucceeded( | 446 void SandboxedUnpacker::UnpackExtensionSucceeded( |
447 std::unique_ptr<base::DictionaryValue> manifest) { | 447 std::unique_ptr<base::DictionaryValue> manifest) { |
448 CHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); | 448 CHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); |
449 | 449 |
450 std::unique_ptr<base::DictionaryValue> final_manifest( | 450 std::unique_ptr<base::DictionaryValue> final_manifest( |
451 RewriteManifestFile(*manifest)); | 451 RewriteManifestFile(*manifest)); |
452 if (!final_manifest) | 452 if (!final_manifest) |
453 return; | 453 return; |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 | 904 |
905 void SandboxedUnpacker::Cleanup() { | 905 void SandboxedUnpacker::Cleanup() { |
906 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); | 906 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); |
907 if (!temp_dir_.Delete()) { | 907 if (!temp_dir_.Delete()) { |
908 LOG(WARNING) << "Can not delete temp directory at " | 908 LOG(WARNING) << "Can not delete temp directory at " |
909 << temp_dir_.GetPath().value(); | 909 << temp_dir_.GetPath().value(); |
910 } | 910 } |
911 } | 911 } |
912 | 912 |
913 } // namespace extensions | 913 } // namespace extensions |
OLD | NEW |