Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 103283003: Media Galleries API Metadata: SafeMediaMetadataParser and IPCTunnelDataReader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | chrome/utility/media_galleries/ipc_data_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9f872c57a43fa1f6e31f4fbe82a2ef37487ffc07..9c883f5161fb9b962c82f314a635035691fdaf93 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_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,14 @@ typedef PdfFunctionsWin PdfFunctions;
typedef PdfFunctionsBase PdfFunctions;
#endif // OS_WIN
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
+void SendMediaMetadataToHost(
+ scoped_ptr<extensions::api::media_galleries::MediaMetadata> metadata) {
+ Send(new ChromeUtilityHostMsg_ParseMediaMetadata_Finished(
+ true, *(metadata->ToValue().get())));
+}
+#endif // !defined(OS_ANDROID) && !defined(OS_IOS)
+
static base::LazyInstance<PdfFunctions> g_pdf_lib = LAZY_INSTANCE_INITIALIZER;
} // namespace
@@ -342,6 +354,8 @@ bool ChromeContentUtilityClient::OnMessageReceived(
#if !defined(OS_ANDROID) && !defined(OS_IOS)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CheckMediaFile, OnCheckMediaFile)
+ IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseMediaMetadata,
+ OnParseMediaMetadata)
#endif // !defined(OS_ANDROID) && !defined(OS_IOS)
#if defined(OS_CHROMEOS)
@@ -759,6 +773,19 @@ void ChromeContentUtilityClient::OnCheckMediaFile(
Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(check_success));
ReleaseProcessIfNeeded();
}
+
+void ChromeContentUtilityClient::OnParseMediaMetadata(
+ const std::string& mime_type,
+ int64 total_size) {
+ // Only one IPCDataSource may be created and added to the list of handlers.
+ CHECK(!media_metadata_parser_);
+ metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size);
+ handlers_.push_back(source);
+
+ media_metadata_parser_.reset(new metadata::MediaMetadataParser(source,
+ mime_type));
+ media_metadata_parser_->Start(base::Bind(&SendMediaMetadataToHost));
+}
#endif // !defined(OS_ANDROID) && !defined(OS_IOS)
#if defined(OS_WIN)
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | chrome/utility/media_galleries/ipc_data_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698