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" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #endif // defined(OS_MACOSX) | 61 #endif // defined(OS_MACOSX) |
62 | 62 |
63 #if defined(OS_WIN) || defined(OS_MACOSX) | 63 #if defined(OS_WIN) || defined(OS_MACOSX) |
64 #include "chrome/utility/media_galleries/iapps_xml_utils.h" | 64 #include "chrome/utility/media_galleries/iapps_xml_utils.h" |
65 #include "chrome/utility/media_galleries/itunes_library_parser.h" | 65 #include "chrome/utility/media_galleries/itunes_library_parser.h" |
66 #include "chrome/utility/media_galleries/picasa_album_table_reader.h" | 66 #include "chrome/utility/media_galleries/picasa_album_table_reader.h" |
67 #include "chrome/utility/media_galleries/picasa_albums_indexer.h" | 67 #include "chrome/utility/media_galleries/picasa_albums_indexer.h" |
68 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 68 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
69 | 69 |
70 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 70 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 71 #include "chrome/common/media_galleries/metadata_types.h" |
71 #include "chrome/utility/media_galleries/image_metadata_extractor.h" | 72 #include "chrome/utility/media_galleries/image_metadata_extractor.h" |
72 #include "chrome/utility/media_galleries/ipc_data_source.h" | 73 #include "chrome/utility/media_galleries/ipc_data_source.h" |
73 #include "chrome/utility/media_galleries/media_metadata_parser.h" | 74 #include "chrome/utility/media_galleries/media_metadata_parser.h" |
74 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 75 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
75 | 76 |
76 #if defined(ENABLE_FULL_PRINTING) | 77 #if defined(ENABLE_FULL_PRINTING) |
77 #include "chrome/common/crash_keys.h" | 78 #include "chrome/common/crash_keys.h" |
78 #include "printing/backend/print_backend.h" | 79 #include "printing/backend/print_backend.h" |
79 #endif | 80 #endif |
80 | 81 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 }; | 297 }; |
297 | 298 |
298 typedef PdfFunctionsWin PdfFunctions; | 299 typedef PdfFunctionsWin PdfFunctions; |
299 #else // OS_WIN | 300 #else // OS_WIN |
300 typedef PdfFunctionsBase PdfFunctions; | 301 typedef PdfFunctionsBase PdfFunctions; |
301 #endif // OS_WIN | 302 #endif // OS_WIN |
302 | 303 |
303 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 304 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
304 void FinishParseMediaMetadata( | 305 void FinishParseMediaMetadata( |
305 metadata::MediaMetadataParser* parser, | 306 metadata::MediaMetadataParser* parser, |
306 scoped_ptr<extensions::api::media_galleries::MediaMetadata> metadata) { | 307 scoped_ptr<extensions::api::media_galleries::MediaMetadata> metadata, |
| 308 const std::vector<metadata::AttachedImage>& attached_images) { |
307 Send(new ChromeUtilityHostMsg_ParseMediaMetadata_Finished( | 309 Send(new ChromeUtilityHostMsg_ParseMediaMetadata_Finished( |
308 true, *(metadata->ToValue().get()))); | 310 true, *(metadata->ToValue().get()), attached_images)); |
309 ReleaseProcessIfNeeded(); | 311 ReleaseProcessIfNeeded(); |
310 } | 312 } |
311 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 313 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
312 | 314 |
313 static base::LazyInstance<PdfFunctions> g_pdf_lib = LAZY_INSTANCE_INITIALIZER; | 315 static base::LazyInstance<PdfFunctions> g_pdf_lib = LAZY_INSTANCE_INITIALIZER; |
314 | 316 |
315 } // namespace | 317 } // namespace |
316 | 318 |
317 ChromeContentUtilityClient::ChromeContentUtilityClient() | 319 ChromeContentUtilityClient::ChromeContentUtilityClient() |
318 : filter_messages_(false) { | 320 : filter_messages_(false) { |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 const IPC::PlatformFileForTransit& media_file) { | 914 const IPC::PlatformFileForTransit& media_file) { |
913 media::MediaFileChecker checker( | 915 media::MediaFileChecker checker( |
914 base::File(IPC::PlatformFileForTransitToPlatformFile(media_file))); | 916 base::File(IPC::PlatformFileForTransitToPlatformFile(media_file))); |
915 const bool check_success = checker.Start( | 917 const bool check_success = checker.Start( |
916 base::TimeDelta::FromMilliseconds(milliseconds_of_decoding)); | 918 base::TimeDelta::FromMilliseconds(milliseconds_of_decoding)); |
917 Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(check_success)); | 919 Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(check_success)); |
918 ReleaseProcessIfNeeded(); | 920 ReleaseProcessIfNeeded(); |
919 } | 921 } |
920 | 922 |
921 void ChromeContentUtilityClient::OnParseMediaMetadata( | 923 void ChromeContentUtilityClient::OnParseMediaMetadata( |
922 const std::string& mime_type, | 924 const std::string& mime_type, int64 total_size, bool get_attached_images) { |
923 int64 total_size) { | |
924 // Only one IPCDataSource may be created and added to the list of handlers. | 925 // Only one IPCDataSource may be created and added to the list of handlers. |
925 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); | 926 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); |
926 handlers_.push_back(source); | 927 handlers_.push_back(source); |
927 | 928 |
928 metadata::MediaMetadataParser* parser = | 929 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( |
929 new metadata::MediaMetadataParser(source, mime_type); | 930 source, mime_type, get_attached_images); |
930 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); | 931 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); |
931 } | 932 } |
932 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 933 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
933 | 934 |
934 #if defined(OS_WIN) | 935 #if defined(OS_WIN) |
935 void ChromeContentUtilityClient::OnParseITunesPrefXml( | 936 void ChromeContentUtilityClient::OnParseITunesPrefXml( |
936 const std::string& itunes_xml_data) { | 937 const std::string& itunes_xml_data) { |
937 base::FilePath library_path( | 938 base::FilePath library_path( |
938 itunes::FindLibraryLocationInPrefXml(itunes_xml_data)); | 939 itunes::FindLibraryLocationInPrefXml(itunes_xml_data)); |
939 Send(new ChromeUtilityHostMsg_GotITunesDirectory(library_path)); | 940 Send(new ChromeUtilityHostMsg_GotITunesDirectory(library_path)); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 NetworkingPrivateCrypto crypto; | 1021 NetworkingPrivateCrypto crypto; |
1021 success = crypto.EncryptByteString(public_key, key_data, &ciphertext); | 1022 success = crypto.EncryptByteString(public_key, key_data, &ciphertext); |
1022 } | 1023 } |
1023 | 1024 |
1024 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext, | 1025 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext, |
1025 success)); | 1026 success)); |
1026 } | 1027 } |
1027 #endif // defined(OS_WIN) | 1028 #endif // defined(OS_WIN) |
1028 | 1029 |
1029 } // namespace chrome | 1030 } // namespace chrome |
OLD | NEW |