| 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 "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 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/common/chrome_utility_messages.h" | 26 #include "chrome/common/chrome_utility_messages.h" |
| 27 #include "chrome/common/extensions/extension_file_util.h" | 27 #include "chrome/common/extensions/extension_file_util.h" |
| 28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 29 #include "content/public/browser/utility_process_host.h" | 29 #include "content/public/browser/utility_process_host.h" |
| 30 #include "content/public/common/common_param_traits.h" | 30 #include "content/public/common/common_param_traits.h" |
| 31 #include "crypto/signature_verifier.h" | 31 #include "crypto/signature_verifier.h" |
| 32 #include "extensions/common/constants.h" | 32 #include "extensions/common/constants.h" |
| 33 #include "extensions/common/crx_file.h" | 33 #include "extensions/common/crx_file.h" |
| 34 #include "extensions/common/extension.h" | 34 #include "extensions/common/extension.h" |
| 35 #include "extensions/common/extension_l10n_util.h" | 35 #include "extensions/common/extension_l10n_util.h" |
| 36 #include "extensions/common/file_util.h" |
| 36 #include "extensions/common/id_util.h" | 37 #include "extensions/common/id_util.h" |
| 37 #include "extensions/common/manifest_constants.h" | 38 #include "extensions/common/manifest_constants.h" |
| 38 #include "extensions/common/manifest_handlers/icons_handler.h" | 39 #include "extensions/common/manifest_handlers/icons_handler.h" |
| 39 #include "grit/generated_resources.h" | 40 #include "grit/generated_resources.h" |
| 40 #include "third_party/skia/include/core/SkBitmap.h" | 41 #include "third_party/skia/include/core/SkBitmap.h" |
| 41 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
| 42 #include "ui/gfx/codec/png_codec.h" | 43 #include "ui/gfx/codec/png_codec.h" |
| 43 | 44 |
| 44 using base::ASCIIToUTF16; | 45 using base::ASCIIToUTF16; |
| 45 using content::BrowserThread; | 46 using content::BrowserThread; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 base::FilePath* temp_dir) { | 161 base::FilePath* temp_dir) { |
| 161 // On ChromeOS, we will only attempt to unpack extension in cryptohome (profile) | 162 // On ChromeOS, we will only attempt to unpack extension in cryptohome (profile) |
| 162 // directory to provide additional security/privacy and speed up the rest of | 163 // directory to provide additional security/privacy and speed up the rest of |
| 163 // the extension install process. | 164 // the extension install process. |
| 164 #if !defined(OS_CHROMEOS) | 165 #if !defined(OS_CHROMEOS) |
| 165 PathService::Get(base::DIR_TEMP, temp_dir); | 166 PathService::Get(base::DIR_TEMP, temp_dir); |
| 166 if (VerifyJunctionFreeLocation(temp_dir)) | 167 if (VerifyJunctionFreeLocation(temp_dir)) |
| 167 return true; | 168 return true; |
| 168 #endif | 169 #endif |
| 169 | 170 |
| 170 *temp_dir = extension_file_util::GetInstallTempDir(extensions_dir); | 171 *temp_dir = file_util::GetInstallTempDir(extensions_dir); |
| 171 if (VerifyJunctionFreeLocation(temp_dir)) | 172 if (VerifyJunctionFreeLocation(temp_dir)) |
| 172 return true; | 173 return true; |
| 173 // Neither paths is link free chances are good installation will fail. | 174 // Neither paths is link free chances are good installation will fail. |
| 174 LOG(ERROR) << "Both the %TEMP% folder and the profile seem to be on " | 175 LOG(ERROR) << "Both the %TEMP% folder and the profile seem to be on " |
| 175 << "remote drives or read-only. Installation can not complete!"; | 176 << "remote drives or read-only. Installation can not complete!"; |
| 176 return false; | 177 return false; |
| 177 } | 178 } |
| 178 | 179 |
| 179 // Read the decoded images back from the file we saved them to. | 180 // Read the decoded images back from the file we saved them to. |
| 180 // |extension_path| is the path to the extension we unpacked that wrote the | 181 // |extension_path| is the path to the extension we unpacked that wrote the |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 | 828 |
| 828 void SandboxedUnpacker::Cleanup() { | 829 void SandboxedUnpacker::Cleanup() { |
| 829 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); | 830 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); |
| 830 if (!temp_dir_.Delete()) { | 831 if (!temp_dir_.Delete()) { |
| 831 LOG(WARNING) << "Can not delete temp directory at " | 832 LOG(WARNING) << "Can not delete temp directory at " |
| 832 << temp_dir_.path().value(); | 833 << temp_dir_.path().value(); |
| 833 } | 834 } |
| 834 } | 835 } |
| 835 | 836 |
| 836 } // namespace extensions | 837 } // namespace extensions |
| OLD | NEW |