| 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/utility/chrome_content_utility_client.h" | 5 #include "chrome/utility/chrome_content_utility_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| 11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "chrome/browser/importer/external_process_importer_bridge.h" | 13 #include "chrome/browser/importer/external_process_importer_bridge.h" |
| 14 #include "chrome/browser/importer/importer.h" | 14 #include "chrome/browser/importer/importer.h" |
| 15 #include "chrome/browser/importer/profile_import_process_messages.h" | 15 #include "chrome/browser/importer/profile_import_process_messages.h" |
| 16 #include "chrome/common/child_process_logging.h" | 16 #include "chrome/common/child_process_logging.h" |
| 17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/chrome_utility_messages.h" | 18 #include "chrome/common/chrome_utility_messages.h" |
| 19 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
| 20 #include "chrome/common/extensions/extension_l10n_util.h" | 20 #include "chrome/common/extensions/extension_l10n_util.h" |
| 21 #include "chrome/common/extensions/extension_unpacker.h" | 21 #include "chrome/common/extensions/unpacker.h" |
| 22 #include "chrome/common/extensions/update_manifest.h" | 22 #include "chrome/common/extensions/update_manifest.h" |
| 23 #include "chrome/common/web_resource/web_resource_unpacker.h" | 23 #include "chrome/common/web_resource/web_resource_unpacker.h" |
| 24 #include "content/public/utility/utility_thread.h" | 24 #include "content/public/utility/utility_thread.h" |
| 25 #include "printing/backend/print_backend.h" | 25 #include "printing/backend/print_backend.h" |
| 26 #include "printing/page_range.h" | 26 #include "printing/page_range.h" |
| 27 #include "third_party/skia/include/core/SkBitmap.h" | 27 #include "third_party/skia/include/core/SkBitmap.h" |
| 28 #include "ui/base/ui_base_switches.h" | 28 #include "ui/base/ui_base_switches.h" |
| 29 #include "ui/gfx/rect.h" | 29 #include "ui/gfx/rect.h" |
| 30 #include "webkit/glue/image_decoder.h" | 30 #include "webkit/glue/image_decoder.h" |
| 31 | 31 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return content::UtilityThread::Get()->Send(message); | 97 return content::UtilityThread::Get()->Send(message); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void ChromeContentUtilityClient::OnUnpackExtension( | 100 void ChromeContentUtilityClient::OnUnpackExtension( |
| 101 const FilePath& extension_path, | 101 const FilePath& extension_path, |
| 102 const std::string& extension_id, | 102 const std::string& extension_id, |
| 103 int location, | 103 int location, |
| 104 int creation_flags) { | 104 int creation_flags) { |
| 105 CHECK(location > extensions::Extension::INVALID); | 105 CHECK(location > extensions::Extension::INVALID); |
| 106 CHECK(location < extensions::Extension::NUM_LOCATIONS); | 106 CHECK(location < extensions::Extension::NUM_LOCATIONS); |
| 107 ExtensionUnpacker unpacker( | 107 extensions::Unpacker unpacker( |
| 108 extension_path, | 108 extension_path, |
| 109 extension_id, | 109 extension_id, |
| 110 static_cast<extensions::Extension::Location>(location), | 110 static_cast<extensions::Extension::Location>(location), |
| 111 creation_flags); | 111 creation_flags); |
| 112 if (unpacker.Run() && unpacker.DumpImagesToFile() && | 112 if (unpacker.Run() && unpacker.DumpImagesToFile() && |
| 113 unpacker.DumpMessageCatalogsToFile()) { | 113 unpacker.DumpMessageCatalogsToFile()) { |
| 114 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded( | 114 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded( |
| 115 *unpacker.parsed_manifest())); | 115 *unpacker.parsed_manifest())); |
| 116 } else { | 116 } else { |
| 117 Send(new ChromeUtilityHostMsg_UnpackExtension_Failed( | 117 Send(new ChromeUtilityHostMsg_UnpackExtension_Failed( |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 435 |
| 436 void ChromeContentUtilityClient::ImporterCleanup() { | 436 void ChromeContentUtilityClient::ImporterCleanup() { |
| 437 importer_->Cancel(); | 437 importer_->Cancel(); |
| 438 importer_ = NULL; | 438 importer_ = NULL; |
| 439 bridge_ = NULL; | 439 bridge_ = NULL; |
| 440 import_thread_.reset(); | 440 import_thread_.reset(); |
| 441 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 441 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace chrome | 444 } // namespace chrome |
| OLD | NEW |