| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/utility/utility_thread.h" | 5 #include "chrome/utility/utility_thread.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/common/child_process.h" | 9 #include "chrome/common/child_process.h" |
| 10 #include "chrome/common/extensions/extension_unpacker.h" | 10 #include "chrome/common/extensions/extension_unpacker.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 IPC_MESSAGE_HANDLER(UtilityMsg_UnpackExtension, OnUnpackExtension) | 24 IPC_MESSAGE_HANDLER(UtilityMsg_UnpackExtension, OnUnpackExtension) |
| 25 IPC_MESSAGE_HANDLER(UtilityMsg_UnpackWebResource, OnUnpackWebResource) | 25 IPC_MESSAGE_HANDLER(UtilityMsg_UnpackWebResource, OnUnpackWebResource) |
| 26 IPC_MESSAGE_HANDLER(UtilityMsg_ParseUpdateManifest, OnParseUpdateManifest) | 26 IPC_MESSAGE_HANDLER(UtilityMsg_ParseUpdateManifest, OnParseUpdateManifest) |
| 27 IPC_END_MESSAGE_MAP() | 27 IPC_END_MESSAGE_MAP() |
| 28 } | 28 } |
| 29 | 29 |
| 30 void UtilityThread::OnUnpackExtension(const FilePath& extension_path) { | 30 void UtilityThread::OnUnpackExtension(const FilePath& extension_path) { |
| 31 ExtensionUnpacker unpacker(extension_path); | 31 ExtensionUnpacker unpacker(extension_path); |
| 32 if (unpacker.Run() && unpacker.DumpImagesToFile()) { | 32 if (unpacker.Run() && unpacker.DumpImagesToFile()) { |
| 33 Send(new UtilityHostMsg_UnpackExtension_Succeeded( | 33 Send(new UtilityHostMsg_UnpackExtension_Succeeded( |
| 34 *unpacker.parsed_manifest())); | 34 *unpacker.parsed_manifest(), *unpacker.parsed_catalogs())); |
| 35 } else { | 35 } else { |
| 36 Send(new UtilityHostMsg_UnpackExtension_Failed(unpacker.error_message())); | 36 Send(new UtilityHostMsg_UnpackExtension_Failed(unpacker.error_message())); |
| 37 } | 37 } |
| 38 | 38 |
| 39 ChildProcess::current()->ReleaseProcess(); | 39 ChildProcess::current()->ReleaseProcess(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void UtilityThread::OnUnpackWebResource(const std::string& resource_data) { | 42 void UtilityThread::OnUnpackWebResource(const std::string& resource_data) { |
| 43 // Parse json data. | 43 // Parse json data. |
| 44 // TODO(mrc): Add the possibility of a template that controls parsing, and | 44 // TODO(mrc): Add the possibility of a template that controls parsing, and |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 | 57 |
| 58 void UtilityThread::OnParseUpdateManifest(const std::string& xml) { | 58 void UtilityThread::OnParseUpdateManifest(const std::string& xml) { |
| 59 UpdateManifest manifest; | 59 UpdateManifest manifest; |
| 60 if (!manifest.Parse(xml)) { | 60 if (!manifest.Parse(xml)) { |
| 61 Send(new UtilityHostMsg_ParseUpdateManifest_Failed(manifest.errors())); | 61 Send(new UtilityHostMsg_ParseUpdateManifest_Failed(manifest.errors())); |
| 62 } else { | 62 } else { |
| 63 Send(new UtilityHostMsg_ParseUpdateManifest_Succeeded(manifest.results())); | 63 Send(new UtilityHostMsg_ParseUpdateManifest_Succeeded(manifest.results())); |
| 64 } | 64 } |
| 65 ChildProcess::current()->ReleaseProcess(); | 65 ChildProcess::current()->ReleaseProcess(); |
| 66 } | 66 } |
| OLD | NEW |