Chromium Code Reviews| 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 677 std::unique_ptr<base::DictionaryValue> original_manifest, | 677 std::unique_ptr<base::DictionaryValue> original_manifest, |
| 678 const SkBitmap& install_icon) { | 678 const SkBitmap& install_icon) { |
| 679 UMA_HISTOGRAM_COUNTS("Extensions.SandboxUnpackSuccess", 1); | 679 UMA_HISTOGRAM_COUNTS("Extensions.SandboxUnpackSuccess", 1); |
| 680 | 680 |
| 681 if (!crx_unpack_start_time_.is_null()) | 681 if (!crx_unpack_start_time_.is_null()) |
| 682 RecordSuccessfulUnpackTimeHistograms( | 682 RecordSuccessfulUnpackTimeHistograms( |
| 683 crx_path_for_histograms_, | 683 crx_path_for_histograms_, |
| 684 base::TimeTicks::Now() - crx_unpack_start_time_); | 684 base::TimeTicks::Now() - crx_unpack_start_time_); |
| 685 DCHECK(!temp_dir_.GetPath().empty()); | 685 DCHECK(!temp_dir_.GetPath().empty()); |
| 686 | 686 |
| 687 // Client takes ownership of temporary directory and extension. | 687 // Client takes ownership of temporary directory and extension. |
|
Noel Gordon
2017/03/30 06:35:41
Maybe this comment needs updating too? Perhaps:
lazyboy
2017/03/30 07:01:51
Done.
| |
| 688 // TODO(https://crbug.com/699528): we should consider transferring the | |
| 689 // ownership of original_manifest to the client as well. | |
| 690 client_->OnUnpackSuccess(temp_dir_.Take(), extension_root_, | 688 client_->OnUnpackSuccess(temp_dir_.Take(), extension_root_, |
| 691 original_manifest.get(), extension_.get(), | 689 std::move(original_manifest), extension_.get(), |
| 692 install_icon); | 690 install_icon); |
| 693 extension_ = NULL; | 691 extension_ = NULL; |
| 694 } | 692 } |
| 695 | 693 |
| 696 base::DictionaryValue* SandboxedUnpacker::RewriteManifestFile( | 694 base::DictionaryValue* SandboxedUnpacker::RewriteManifestFile( |
| 697 const base::DictionaryValue& manifest) { | 695 const base::DictionaryValue& manifest) { |
| 698 // Add the public key extracted earlier to the parsed manifest and overwrite | 696 // Add the public key extracted earlier to the parsed manifest and overwrite |
| 699 // the original manifest. We do this to ensure the manifest doesn't contain an | 697 // the original manifest. We do this to ensure the manifest doesn't contain an |
| 700 // exploitable bug that could be used to compromise the browser. | 698 // exploitable bug that could be used to compromise the browser. |
| 701 DCHECK(!public_key_.empty()); | 699 DCHECK(!public_key_.empty()); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 906 | 904 |
| 907 void SandboxedUnpacker::Cleanup() { | 905 void SandboxedUnpacker::Cleanup() { |
| 908 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); | 906 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); |
| 909 if (!temp_dir_.Delete()) { | 907 if (!temp_dir_.Delete()) { |
| 910 LOG(WARNING) << "Can not delete temp directory at " | 908 LOG(WARNING) << "Can not delete temp directory at " |
| 911 << temp_dir_.GetPath().value(); | 909 << temp_dir_.GetPath().value(); |
| 912 } | 910 } |
| 913 } | 911 } |
| 914 | 912 |
| 915 } // namespace extensions | 913 } // namespace extensions |
| OLD | NEW |