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

Side by Side Diff: chrome/utility/chrome_content_utility_client.cc

Issue 250143002: Media Galleries API: Audio/Video attached pictures support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 }; 296 };
297 297
298 typedef PdfFunctionsWin PdfFunctions; 298 typedef PdfFunctionsWin PdfFunctions;
299 #else // OS_WIN 299 #else // OS_WIN
300 typedef PdfFunctionsBase PdfFunctions; 300 typedef PdfFunctionsBase PdfFunctions;
301 #endif // OS_WIN 301 #endif // OS_WIN
302 302
303 #if !defined(OS_ANDROID) && !defined(OS_IOS) 303 #if !defined(OS_ANDROID) && !defined(OS_IOS)
304 void FinishParseMediaMetadata( 304 void FinishParseMediaMetadata(
305 metadata::MediaMetadataParser* parser, 305 metadata::MediaMetadataParser* parser,
306 scoped_ptr<extensions::api::media_galleries::MediaMetadata> metadata) { 306 scoped_ptr<extensions::api::media_galleries::MediaMetadata> metadata,
307 const std::vector<std::string>& attached_pictures_bytes,
308 const std::vector<std::string>& attached_pictures_types) {
307 Send(new ChromeUtilityHostMsg_ParseMediaMetadata_Finished( 309 Send(new ChromeUtilityHostMsg_ParseMediaMetadata_Finished(
308 true, *(metadata->ToValue().get()))); 310 true, *(metadata->ToValue().get()), attached_pictures_bytes,
311 attached_pictures_types));
309 ReleaseProcessIfNeeded(); 312 ReleaseProcessIfNeeded();
310 } 313 }
311 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 314 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
312 315
313 static base::LazyInstance<PdfFunctions> g_pdf_lib = LAZY_INSTANCE_INITIALIZER; 316 static base::LazyInstance<PdfFunctions> g_pdf_lib = LAZY_INSTANCE_INITIALIZER;
314 317
315 } // namespace 318 } // namespace
316 319
317 ChromeContentUtilityClient::ChromeContentUtilityClient() 320 ChromeContentUtilityClient::ChromeContentUtilityClient()
318 : filter_messages_(false) { 321 : filter_messages_(false) {
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 const IPC::PlatformFileForTransit& media_file) { 915 const IPC::PlatformFileForTransit& media_file) {
913 media::MediaFileChecker checker( 916 media::MediaFileChecker checker(
914 base::File(IPC::PlatformFileForTransitToPlatformFile(media_file))); 917 base::File(IPC::PlatformFileForTransitToPlatformFile(media_file)));
915 const bool check_success = checker.Start( 918 const bool check_success = checker.Start(
916 base::TimeDelta::FromMilliseconds(milliseconds_of_decoding)); 919 base::TimeDelta::FromMilliseconds(milliseconds_of_decoding));
917 Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(check_success)); 920 Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(check_success));
918 ReleaseProcessIfNeeded(); 921 ReleaseProcessIfNeeded();
919 } 922 }
920 923
921 void ChromeContentUtilityClient::OnParseMediaMetadata( 924 void ChromeContentUtilityClient::OnParseMediaMetadata(
922 const std::string& mime_type, 925 const std::string& mime_type, int64 total_size,
923 int64 total_size) { 926 bool get_attached_pictures) {
924 // Only one IPCDataSource may be created and added to the list of handlers. 927 // Only one IPCDataSource may be created and added to the list of handlers.
925 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); 928 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size);
926 handlers_.push_back(source); 929 handlers_.push_back(source);
927 930
928 metadata::MediaMetadataParser* parser = 931 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser(
929 new metadata::MediaMetadataParser(source, mime_type); 932 source, mime_type, get_attached_pictures);
930 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); 933 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser)));
931 } 934 }
932 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 935 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
933 936
934 #if defined(OS_WIN) 937 #if defined(OS_WIN)
935 void ChromeContentUtilityClient::OnParseITunesPrefXml( 938 void ChromeContentUtilityClient::OnParseITunesPrefXml(
936 const std::string& itunes_xml_data) { 939 const std::string& itunes_xml_data) {
937 base::FilePath library_path( 940 base::FilePath library_path(
938 itunes::FindLibraryLocationInPrefXml(itunes_xml_data)); 941 itunes::FindLibraryLocationInPrefXml(itunes_xml_data));
939 Send(new ChromeUtilityHostMsg_GotITunesDirectory(library_path)); 942 Send(new ChromeUtilityHostMsg_GotITunesDirectory(library_path));
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 NetworkingPrivateCrypto crypto; 1023 NetworkingPrivateCrypto crypto;
1021 success = crypto.EncryptByteString(public_key, key_data, &ciphertext); 1024 success = crypto.EncryptByteString(public_key, key_data, &ciphertext);
1022 } 1025 }
1023 1026
1024 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext, 1027 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext,
1025 success)); 1028 success));
1026 } 1029 }
1027 #endif // defined(OS_WIN) 1030 #endif // defined(OS_WIN)
1028 1031
1029 } // namespace chrome 1032 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698