Chromium Code Reviews| Index: chrome/utility/chrome_content_utility_client.cc |
| diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc |
| index 48acaa94ea95781f133a9d6958c52b39b8c47a53..7e20ed416e69ec6787b37f854e9067ad81fac546 100644 |
| --- a/chrome/utility/chrome_content_utility_client.cc |
| +++ b/chrome/utility/chrome_content_utility_client.cc |
| @@ -11,7 +11,6 @@ |
| #include "base/files/file_path.h" |
| #include "base/json/json_reader.h" |
| #include "base/memory/ref_counted.h" |
| -#include "base/memory/scoped_ptr.h" |
| #include "base/path_service.h" |
| #include "base/scoped_native_library.h" |
| #include "base/time/time.h" |
| @@ -61,6 +60,11 @@ |
| #include "chrome/utility/media_galleries/picasa_albums_indexer.h" |
| #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| +#if !defined(OS_ANDROID) && !defined(OS_IOS) |
| +#include "chrome/utility/media_galleries/ipc_tunnel_data_source.h" |
| +#include "chrome/utility/media_galleries/media_metadata_parser.h" |
| +#endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| + |
| #if defined(ENABLE_FULL_PRINTING) |
| #include "chrome/common/crash_keys.h" |
| #include "printing/backend/print_backend.h" |
| @@ -289,6 +293,12 @@ typedef PdfFunctionsWin PdfFunctions; |
| typedef PdfFunctionsBase PdfFunctions; |
| #endif // OS_WIN |
| +void SendMediaMetadataToHost( |
| + scoped_ptr<extensions::api::media_galleries::MediaMetadata> metadata) { |
| + Send(new ChromeUtilityHostMsg_ParseMediaMetadata_Finished( |
| + true, *(metadata->ToValue().get()))); |
| +} |
| + |
| static base::LazyInstance<PdfFunctions> g_pdf_lib = LAZY_INSTANCE_INITIALIZER; |
| } // namespace |
| @@ -342,6 +352,11 @@ bool ChromeContentUtilityClient::OnMessageReceived( |
| #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CheckMediaFile, OnCheckMediaFile) |
| + IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseMediaMetadata, |
| + OnParseMediaMetadata) |
| + IPC_MESSAGE_HANDLER( |
| + ChromeUtilityMsg_ParseMediaMetadata_RequestBlobBytes_Finished, |
| + OnParseMediaMetadataRequestBlobBytesFinished) |
| #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| #if defined(OS_CHROMEOS) |
| @@ -759,6 +774,26 @@ void ChromeContentUtilityClient::OnCheckMediaFile( |
| Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(check_success)); |
| ReleaseProcessIfNeeded(); |
| } |
| + |
| +void ChromeContentUtilityClient::OnParseMediaMetadata( |
| + const std::string& mime_type, |
| + int64 total_size) { |
| + DCHECK(!media_metadata_parser_); |
| + DCHECK(!ipc_tunnel_data_source_); |
| + |
| + ipc_tunnel_data_source_.reset(new metadata::IPCTunnelDataSource(total_size)); |
| + media_metadata_parser_.reset(new metadata::MediaMetadataParser( |
| + ipc_tunnel_data_source_.get(), mime_type)); |
| + media_metadata_parser_->Start(base::Bind(&SendMediaMetadataToHost)); |
| +} |
| + |
| +void ChromeContentUtilityClient::OnParseMediaMetadataRequestBlobBytesFinished( |
|
vandebo (ex-Chrome)
2014/01/07 18:34:59
I suggest making IPCDataSource a message Listener
tommycli
2014/01/07 20:23:31
Done. This is better, but I have one concern left:
|
| + int64 request_id, |
| + const std::string& bytes) { |
| + if (!ipc_tunnel_data_source_) |
| + return; |
| + ipc_tunnel_data_source_->ReceiveBytes(request_id, bytes); |
| +} |
| #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| #if defined(OS_WIN) |