OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_extension_unpacker.h" | 5 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
| 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" |
9 #include "base/base64.h" | 11 #include "base/base64.h" |
10 #include "base/file_util.h" | 12 #include "base/file_util.h" |
11 #include "base/file_util_proxy.h" | |
12 #include "base/json/json_value_serializer.h" | 13 #include "base/json/json_value_serializer.h" |
13 #include "base/memory/scoped_handle.h" | 14 #include "base/memory/scoped_handle.h" |
14 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
15 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
16 #include "base/path_service.h" | 17 #include "base/path_service.h" |
17 #include "base/task.h" | 18 #include "base/task.h" |
18 #include "base/utf_string_conversions.h" // TODO(viettrungluu): delete me. | 19 #include "base/utf_string_conversions.h" // TODO(viettrungluu): delete me. |
19 #include "crypto/signature_verifier.h" | 20 #include "crypto/signature_verifier.h" |
20 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
21 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 if (unpacker.Run() && unpacker.DumpImagesToFile() && | 217 if (unpacker.Run() && unpacker.DumpImagesToFile() && |
217 unpacker.DumpMessageCatalogsToFile()) { | 218 unpacker.DumpMessageCatalogsToFile()) { |
218 OnUnpackExtensionSucceeded(*unpacker.parsed_manifest()); | 219 OnUnpackExtensionSucceeded(*unpacker.parsed_manifest()); |
219 } else { | 220 } else { |
220 OnUnpackExtensionFailed(unpacker.error_message()); | 221 OnUnpackExtensionFailed(unpacker.error_message()); |
221 } | 222 } |
222 } | 223 } |
223 } | 224 } |
224 | 225 |
225 SandboxedExtensionUnpacker::~SandboxedExtensionUnpacker() { | 226 SandboxedExtensionUnpacker::~SandboxedExtensionUnpacker() { |
226 base::FileUtilProxy::Delete( | 227 BrowserThread::GetMessageLoopProxyForThread(thread_identifier_)->PostTask( |
227 BrowserThread::GetMessageLoopProxyForThread(thread_identifier_), | 228 FROM_HERE, |
228 temp_dir_.Take(), | 229 base::IgnoreReturn(base::Callback<bool(void)>( |
229 true, | 230 base::Bind(&file_util::Delete, temp_dir_.Take(), true)))); |
230 NULL); | |
231 } | 231 } |
232 | 232 |
233 bool SandboxedExtensionUnpacker::OnMessageReceived( | 233 bool SandboxedExtensionUnpacker::OnMessageReceived( |
234 const IPC::Message& message) { | 234 const IPC::Message& message) { |
235 bool handled = true; | 235 bool handled = true; |
236 IPC_BEGIN_MESSAGE_MAP(SandboxedExtensionUnpacker, message) | 236 IPC_BEGIN_MESSAGE_MAP(SandboxedExtensionUnpacker, message) |
237 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnpackExtension_Succeeded, | 237 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnpackExtension_Succeeded, |
238 OnUnpackExtensionSucceeded) | 238 OnUnpackExtensionSucceeded) |
239 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnpackExtension_Failed, | 239 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnpackExtension_Failed, |
240 OnUnpackExtensionFailed) | 240 OnUnpackExtensionFailed) |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 ERROR_SAVING_CATALOG, | 709 ERROR_SAVING_CATALOG, |
710 l10n_util::GetStringFUTF8( | 710 l10n_util::GetStringFUTF8( |
711 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, | 711 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, |
712 ASCIIToUTF16("ERROR_SAVING_CATALOG"))); | 712 ASCIIToUTF16("ERROR_SAVING_CATALOG"))); |
713 return false; | 713 return false; |
714 } | 714 } |
715 } | 715 } |
716 | 716 |
717 return true; | 717 return true; |
718 } | 718 } |
OLD | NEW |