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/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "chrome/common/chrome_utility_messages.h" | 12 #include "chrome/common/chrome_utility_messages.h" |
13 #include "chrome/common/extensions/chrome_manifest_handlers.h" | 13 #include "chrome/common/extensions/chrome_manifest_handlers.h" |
14 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
15 #include "chrome/common/extensions/extension_l10n_util.h" | 15 #include "chrome/common/extensions/extension_l10n_util.h" |
16 #include "chrome/common/extensions/manifest.h" | 16 #include "chrome/common/extensions/manifest.h" |
17 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" | 17 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" |
18 #include "chrome/common/extensions/unpacker.h" | 18 #include "chrome/common/extensions/unpacker.h" |
19 #include "chrome/common/extensions/update_manifest.h" | 19 #include "chrome/common/extensions/update_manifest.h" |
20 #include "chrome/common/safe_browsing/zip_analyzer.h" | 20 #include "chrome/common/safe_browsing/zip_analyzer.h" |
21 #include "chrome/common/web_resource/web_resource_unpacker.h" | 21 #include "chrome/common/web_resource/web_resource_unpacker.h" |
22 #include "chrome/utility/profile_import_handler.h" | 22 #include "chrome/utility/profile_import_handler.h" |
| 23 #include "content/public/child/image_decoder_utils.h" |
23 #include "content/public/utility/utility_thread.h" | 24 #include "content/public/utility/utility_thread.h" |
24 #include "printing/page_range.h" | 25 #include "printing/page_range.h" |
25 #include "third_party/skia/include/core/SkBitmap.h" | 26 #include "third_party/skia/include/core/SkBitmap.h" |
26 #include "third_party/zlib/google/zip.h" | 27 #include "third_party/zlib/google/zip.h" |
27 #include "ui/base/ui_base_switches.h" | 28 #include "ui/base/ui_base_switches.h" |
28 #include "ui/gfx/codec/jpeg_codec.h" | 29 #include "ui/gfx/codec/jpeg_codec.h" |
29 #include "ui/gfx/rect.h" | 30 #include "ui/gfx/rect.h" |
30 #include "webkit/glue/image_decoder.h" | 31 #include "ui/gfx/size.h" |
31 | 32 |
32 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
33 #include "base/file_util.h" | 34 #include "base/file_util.h" |
34 #include "base/path_service.h" | 35 #include "base/path_service.h" |
35 #include "base/win/iat_patch_function.h" | 36 #include "base/win/iat_patch_function.h" |
36 #include "base/win/scoped_handle.h" | 37 #include "base/win/scoped_handle.h" |
37 #include "chrome/common/chrome_paths.h" | 38 #include "chrome/common/chrome_paths.h" |
38 #include "chrome/utility/itunes_pref_parser_win.h" | 39 #include "chrome/utility/itunes_pref_parser_win.h" |
39 #include "printing/emf_win.h" | 40 #include "printing/emf_win.h" |
40 #include "ui/gfx/gdi_util.h" | 41 #include "ui/gfx/gdi_util.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 manifest.errors())); | 189 manifest.errors())); |
189 } else { | 190 } else { |
190 Send(new ChromeUtilityHostMsg_ParseUpdateManifest_Succeeded( | 191 Send(new ChromeUtilityHostMsg_ParseUpdateManifest_Succeeded( |
191 manifest.results())); | 192 manifest.results())); |
192 } | 193 } |
193 ReleaseProcessIfNeeded(); | 194 ReleaseProcessIfNeeded(); |
194 } | 195 } |
195 | 196 |
196 void ChromeContentUtilityClient::OnDecodeImage( | 197 void ChromeContentUtilityClient::OnDecodeImage( |
197 const std::vector<unsigned char>& encoded_data) { | 198 const std::vector<unsigned char>& encoded_data) { |
198 webkit_glue::ImageDecoder decoder; | 199 const SkBitmap& decoded_image = content::DecodeImage(&encoded_data[0], |
199 const SkBitmap& decoded_image = decoder.Decode(&encoded_data[0], | 200 gfx::Size(), |
200 encoded_data.size()); | 201 encoded_data.size()); |
201 if (decoded_image.empty()) { | 202 if (decoded_image.empty()) { |
202 Send(new ChromeUtilityHostMsg_DecodeImage_Failed()); | 203 Send(new ChromeUtilityHostMsg_DecodeImage_Failed()); |
203 } else { | 204 } else { |
204 Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(decoded_image)); | 205 Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(decoded_image)); |
205 } | 206 } |
206 ReleaseProcessIfNeeded(); | 207 ReleaseProcessIfNeeded(); |
207 } | 208 } |
208 | 209 |
209 void ChromeContentUtilityClient::OnDecodeImageBase64( | 210 void ChromeContentUtilityClient::OnDecodeImageBase64( |
210 const std::string& encoded_string) { | 211 const std::string& encoded_string) { |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 base::PlatformFile file = | 512 base::PlatformFile file = |
512 IPC::PlatformFileForTransitToPlatformFile(itunes_library_file); | 513 IPC::PlatformFileForTransitToPlatformFile(itunes_library_file); |
513 bool result = parser.Parse( | 514 bool result = parser.Parse( |
514 itunes::ITunesLibraryParser::ReadITunesLibraryXmlFile(file)); | 515 itunes::ITunesLibraryParser::ReadITunesLibraryXmlFile(file)); |
515 Send(new ChromeUtilityHostMsg_GotITunesLibrary(result, parser.library())); | 516 Send(new ChromeUtilityHostMsg_GotITunesLibrary(result, parser.library())); |
516 ReleaseProcessIfNeeded(); | 517 ReleaseProcessIfNeeded(); |
517 } | 518 } |
518 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 519 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
519 | 520 |
520 } // namespace chrome | 521 } // namespace chrome |
OLD | NEW |