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/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/message_loop_proxy.h" | 13 #include "base/message_loop_proxy.h" |
14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
15 #include "chrome/browser/importer/importer.h" | 15 #include "chrome/browser/importer/importer.h" |
16 #include "chrome/browser/importer/profile_import_process_messages.h" | 16 #include "chrome/browser/importer/profile_import_process_messages.h" |
17 #include "chrome/common/child_process_logging.h" | 17 #include "chrome/common/child_process_logging.h" |
18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/common/chrome_utility_messages.h" | 19 #include "chrome/common/chrome_utility_messages.h" |
20 #include "chrome/common/extensions/api/extension_action/browser_action_handler.h
" | 20 #include "chrome/common/extensions/api/extension_action/browser_action_handler.h
" |
21 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
22 #include "chrome/common/extensions/extension_l10n_util.h" | 22 #include "chrome/common/extensions/extension_l10n_util.h" |
23 #include "chrome/common/extensions/extension_manifest_constants.h" | 23 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 24 #include "chrome/common/extensions/manifest.h" |
24 #include "chrome/common/extensions/manifest_handler.h" | 25 #include "chrome/common/extensions/manifest_handler.h" |
25 #include "chrome/common/extensions/unpacker.h" | 26 #include "chrome/common/extensions/unpacker.h" |
26 #include "chrome/common/extensions/update_manifest.h" | 27 #include "chrome/common/extensions/update_manifest.h" |
27 #include "chrome/common/web_resource/web_resource_unpacker.h" | 28 #include "chrome/common/web_resource/web_resource_unpacker.h" |
28 #include "chrome/common/zip.h" | 29 #include "chrome/common/zip.h" |
29 #include "chrome/utility/profile_import_handler.h" | 30 #include "chrome/utility/profile_import_handler.h" |
30 #include "content/public/utility/utility_thread.h" | 31 #include "content/public/utility/utility_thread.h" |
31 #include "printing/backend/print_backend.h" | 32 #include "printing/backend/print_backend.h" |
32 #include "printing/page_range.h" | 33 #include "printing/page_range.h" |
33 #include "third_party/skia/include/core/SkBitmap.h" | 34 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 122 |
122 bool ChromeContentUtilityClient::Send(IPC::Message* message) { | 123 bool ChromeContentUtilityClient::Send(IPC::Message* message) { |
123 return content::UtilityThread::Get()->Send(message); | 124 return content::UtilityThread::Get()->Send(message); |
124 } | 125 } |
125 | 126 |
126 void ChromeContentUtilityClient::OnUnpackExtension( | 127 void ChromeContentUtilityClient::OnUnpackExtension( |
127 const FilePath& extension_path, | 128 const FilePath& extension_path, |
128 const std::string& extension_id, | 129 const std::string& extension_id, |
129 int location, | 130 int location, |
130 int creation_flags) { | 131 int creation_flags) { |
131 CHECK(location > extensions::Extension::INVALID); | 132 CHECK(location > extensions::Manifest::INVALID_LOCATION); |
132 CHECK(location < extensions::Extension::NUM_LOCATIONS); | 133 CHECK(location < extensions::Manifest::NUM_LOCATIONS); |
133 RegisterExtensionManifestHandlers(); | 134 RegisterExtensionManifestHandlers(); |
134 extensions::Unpacker unpacker( | 135 extensions::Unpacker unpacker( |
135 extension_path, | 136 extension_path, |
136 extension_id, | 137 extension_id, |
137 static_cast<extensions::Extension::Location>(location), | 138 static_cast<extensions::Manifest::Location>(location), |
138 creation_flags); | 139 creation_flags); |
139 if (unpacker.Run() && unpacker.DumpImagesToFile() && | 140 if (unpacker.Run() && unpacker.DumpImagesToFile() && |
140 unpacker.DumpMessageCatalogsToFile()) { | 141 unpacker.DumpMessageCatalogsToFile()) { |
141 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded( | 142 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded( |
142 *unpacker.parsed_manifest())); | 143 *unpacker.parsed_manifest())); |
143 } else { | 144 } else { |
144 Send(new ChromeUtilityHostMsg_UnpackExtension_Failed( | 145 Send(new ChromeUtilityHostMsg_UnpackExtension_Failed( |
145 unpacker.error_message())); | 146 unpacker.error_message())); |
146 } | 147 } |
147 | 148 |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 } else | 457 } else |
457 #endif | 458 #endif |
458 { | 459 { |
459 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( | 460 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( |
460 printer_name)); | 461 printer_name)); |
461 } | 462 } |
462 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 463 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
463 } | 464 } |
464 | 465 |
465 } // namespace chrome | 466 } // namespace chrome |
OLD | NEW |