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/api/i18n/default_locale_handler.h" | 21 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" |
22 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
23 #include "chrome/common/extensions/extension_l10n_util.h" | 23 #include "chrome/common/extensions/extension_l10n_util.h" |
24 #include "chrome/common/extensions/extension_manifest_constants.h" | 24 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 25 #include "chrome/common/extensions/manifest.h" |
25 #include "chrome/common/extensions/manifest_handler.h" | 26 #include "chrome/common/extensions/manifest_handler.h" |
26 #include "chrome/common/extensions/unpacker.h" | 27 #include "chrome/common/extensions/unpacker.h" |
27 #include "chrome/common/extensions/update_manifest.h" | 28 #include "chrome/common/extensions/update_manifest.h" |
28 #include "chrome/common/web_resource/web_resource_unpacker.h" | 29 #include "chrome/common/web_resource/web_resource_unpacker.h" |
29 #include "chrome/common/zip.h" | 30 #include "chrome/common/zip.h" |
30 #include "chrome/utility/profile_import_handler.h" | 31 #include "chrome/utility/profile_import_handler.h" |
31 #include "content/public/utility/utility_thread.h" | 32 #include "content/public/utility/utility_thread.h" |
32 #include "printing/backend/print_backend.h" | 33 #include "printing/backend/print_backend.h" |
33 #include "printing/page_range.h" | 34 #include "printing/page_range.h" |
34 #include "third_party/skia/include/core/SkBitmap.h" | 35 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 126 |
126 bool ChromeContentUtilityClient::Send(IPC::Message* message) { | 127 bool ChromeContentUtilityClient::Send(IPC::Message* message) { |
127 return content::UtilityThread::Get()->Send(message); | 128 return content::UtilityThread::Get()->Send(message); |
128 } | 129 } |
129 | 130 |
130 void ChromeContentUtilityClient::OnUnpackExtension( | 131 void ChromeContentUtilityClient::OnUnpackExtension( |
131 const FilePath& extension_path, | 132 const FilePath& extension_path, |
132 const std::string& extension_id, | 133 const std::string& extension_id, |
133 int location, | 134 int location, |
134 int creation_flags) { | 135 int creation_flags) { |
135 CHECK(location > extensions::Extension::INVALID); | 136 CHECK(location > extensions::Manifest::INVALID_LOCATION); |
136 CHECK(location < extensions::Extension::NUM_LOCATIONS); | 137 CHECK(location < extensions::Manifest::NUM_LOCATIONS); |
137 RegisterExtensionManifestHandlers(); | 138 RegisterExtensionManifestHandlers(); |
138 extensions::Unpacker unpacker( | 139 extensions::Unpacker unpacker( |
139 extension_path, | 140 extension_path, |
140 extension_id, | 141 extension_id, |
141 static_cast<extensions::Extension::Location>(location), | 142 static_cast<extensions::Manifest::Location>(location), |
142 creation_flags); | 143 creation_flags); |
143 if (unpacker.Run() && unpacker.DumpImagesToFile() && | 144 if (unpacker.Run() && unpacker.DumpImagesToFile() && |
144 unpacker.DumpMessageCatalogsToFile()) { | 145 unpacker.DumpMessageCatalogsToFile()) { |
145 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded( | 146 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded( |
146 *unpacker.parsed_manifest())); | 147 *unpacker.parsed_manifest())); |
147 } else { | 148 } else { |
148 Send(new ChromeUtilityHostMsg_UnpackExtension_Failed( | 149 Send(new ChromeUtilityHostMsg_UnpackExtension_Failed( |
149 unpacker.error_message())); | 150 unpacker.error_message())); |
150 } | 151 } |
151 | 152 |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 } else | 461 } else |
461 #endif | 462 #endif |
462 { | 463 { |
463 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( | 464 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( |
464 printer_name)); | 465 printer_name)); |
465 } | 466 } |
466 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 467 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
467 } | 468 } |
468 | 469 |
469 } // namespace chrome | 470 } // namespace chrome |
OLD | NEW |