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 13 matching lines...) Expand all Loading... |
24 #include "base/threading/sequenced_worker_pool.h" | 24 #include "base/threading/sequenced_worker_pool.h" |
25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
26 #include "components/crx_file/crx_verifier.h" | 26 #include "components/crx_file/crx_verifier.h" |
27 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
28 #include "extensions/common/constants.h" | 28 #include "extensions/common/constants.h" |
29 #include "extensions/common/extension.h" | 29 #include "extensions/common/extension.h" |
30 #include "extensions/common/extension_l10n_util.h" | 30 #include "extensions/common/extension_l10n_util.h" |
31 #include "extensions/common/extension_unpacker.mojom.h" | 31 #include "extensions/common/extension_unpacker.mojom.h" |
32 #include "extensions/common/extension_utility_types.h" | 32 #include "extensions/common/extension_utility_types.h" |
33 #include "extensions/common/extensions_client.h" | 33 #include "extensions/common/extensions_client.h" |
| 34 #include "extensions/common/features/feature_channel.h" |
| 35 #include "extensions/common/features/feature_session_type.h" |
34 #include "extensions/common/file_util.h" | 36 #include "extensions/common/file_util.h" |
35 #include "extensions/common/manifest_constants.h" | 37 #include "extensions/common/manifest_constants.h" |
36 #include "extensions/common/manifest_handlers/icons_handler.h" | 38 #include "extensions/common/manifest_handlers/icons_handler.h" |
37 #include "extensions/common/switches.h" | 39 #include "extensions/common/switches.h" |
38 #include "extensions/strings/grit/extensions_strings.h" | 40 #include "extensions/strings/grit/extensions_strings.h" |
39 #include "third_party/skia/include/core/SkBitmap.h" | 41 #include "third_party/skia/include/core/SkBitmap.h" |
40 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
41 #include "ui/gfx/codec/png_codec.h" | 43 #include "ui/gfx/codec/png_codec.h" |
42 | 44 |
43 using base::ASCIIToUTF16; | 45 using base::ASCIIToUTF16; |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 417 } |
416 | 418 |
417 void SandboxedUnpacker::Unpack(const base::FilePath& directory) { | 419 void SandboxedUnpacker::Unpack(const base::FilePath& directory) { |
418 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 420 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
419 | 421 |
420 StartUtilityProcessIfNeeded(); | 422 StartUtilityProcessIfNeeded(); |
421 | 423 |
422 DCHECK(directory.DirName() == temp_dir_.GetPath()); | 424 DCHECK(directory.DirName() == temp_dir_.GetPath()); |
423 | 425 |
424 utility_process_mojo_client_->service()->Unpack( | 426 utility_process_mojo_client_->service()->Unpack( |
425 directory, extension_id_, location_, creation_flags_, | 427 GetCurrentChannel(), GetCurrentFeatureSessionType(), directory, |
| 428 extension_id_, location_, creation_flags_, |
426 base::Bind(&SandboxedUnpacker::UnpackDone, this)); | 429 base::Bind(&SandboxedUnpacker::UnpackDone, this)); |
427 } | 430 } |
428 | 431 |
429 void SandboxedUnpacker::UnpackDone( | 432 void SandboxedUnpacker::UnpackDone( |
430 const base::string16& error, | 433 const base::string16& error, |
431 std::unique_ptr<base::DictionaryValue> manifest) { | 434 std::unique_ptr<base::DictionaryValue> manifest) { |
432 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 435 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
433 | 436 |
434 utility_process_mojo_client_.reset(); | 437 utility_process_mojo_client_.reset(); |
435 | 438 |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 | 909 |
907 void SandboxedUnpacker::Cleanup() { | 910 void SandboxedUnpacker::Cleanup() { |
908 DCHECK(unpacker_io_task_runner_->RunsTasksInCurrentSequence()); | 911 DCHECK(unpacker_io_task_runner_->RunsTasksInCurrentSequence()); |
909 if (!temp_dir_.Delete()) { | 912 if (!temp_dir_.Delete()) { |
910 LOG(WARNING) << "Can not delete temp directory at " | 913 LOG(WARNING) << "Can not delete temp directory at " |
911 << temp_dir_.GetPath().value(); | 914 << temp_dir_.GetPath().value(); |
912 } | 915 } |
913 } | 916 } |
914 | 917 |
915 } // namespace extensions | 918 } // namespace extensions |
OLD | NEW |