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

Side by Side Diff: chrome/browser/extensions/api/media_galleries/media_galleries_api.h

Issue 250143002: Media Galleries API: Audio/Video attached pictures support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create Blobs on browser-process, eliminating two IPC copies. Created 6 years, 7 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 // Defines the Chrome Extensions Media Galleries API functions for accessing 5 // Defines the Chrome Extensions Media Galleries API functions for accessing
6 // user's media files, as specified in the extension API IDL. 6 // user's media files, as specified in the extension API IDL.
7 7
8 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_
9 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ 9 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback_forward.h" 14 #include "base/callback_forward.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "chrome/browser/extensions/chrome_extension_function.h" 17 #include "chrome/browser/extensions/chrome_extension_function.h"
18 #include "chrome/browser/media_galleries/media_file_system_registry.h" 18 #include "chrome/browser/media_galleries/media_file_system_registry.h"
19 #include "chrome/browser/media_galleries/media_scan_manager_observer.h" 19 #include "chrome/browser/media_galleries/media_scan_manager_observer.h"
20 #include "chrome/common/extensions/api/media_galleries.h" 20 #include "chrome/common/extensions/api/media_galleries.h"
21 #include "chrome/common/media_galleries/metadata_types.h"
21 #include "components/storage_monitor/media_storage_util.h" 22 #include "components/storage_monitor/media_storage_util.h"
22 #include "extensions/browser/browser_context_keyed_api_factory.h" 23 #include "extensions/browser/browser_context_keyed_api_factory.h"
23 24
24 namespace MediaGalleries = extensions::api::media_galleries; 25 namespace MediaGalleries = extensions::api::media_galleries;
25 26
26 class MediaGalleriesScanResultDialogController; 27 class MediaGalleriesScanResultDialogController;
27 28
28 namespace content { 29 namespace content {
29 class WebContents; 30 class WebContents;
30 } 31 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 public: 257 public:
257 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMetadata", 258 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMetadata",
258 MEDIAGALLERIES_GETMETADATA) 259 MEDIAGALLERIES_GETMETADATA)
259 260
260 protected: 261 protected:
261 virtual ~MediaGalleriesGetMetadataFunction(); 262 virtual ~MediaGalleriesGetMetadataFunction();
262 virtual bool RunImpl() OVERRIDE; 263 virtual bool RunImpl() OVERRIDE;
263 264
264 private: 265 private:
265 // Bottom half for RunImpl, invoked after the preferences is initialized. 266 // Bottom half for RunImpl, invoked after the preferences is initialized.
266 void OnPreferencesInit(bool mime_type_only, const std::string& blob_uuid); 267 void OnPreferencesInit(bool mime_type_only, bool get_attached_images,
268 const std::string& blob_uuid);
267 269
268 void SniffMimeType(bool mime_type_only, 270 void GetMetadata(bool mime_type_only, bool get_attached_images,
269 const std::string& blob_uuid, 271 const std::string& blob_uuid,
270 scoped_ptr<std::string> blob_header, 272 scoped_ptr<std::string> blob_header,
271 int64 total_blob_length); 273 int64 total_blob_length);
272 274
273 void OnSafeMediaMetadataParserDone( 275 void OnSafeMediaMetadataParserDone(
274 bool parse_success, base::DictionaryValue* metadata_dictionary); 276 bool parse_success, base::DictionaryValue* metadata_dictionary,
277 const std::vector<metadata::AttachedImage>& attached_images);
278
279 std::vector<std::string> CreateBlobsOnIOThread(
280 const std::vector<metadata::AttachedImage>& attached_images);
281
282 void FinishWithBlobsOnUIThread(
283 base::DictionaryValue* metadata_dictionary,
284 const std::vector<metadata::AttachedImage>& attached_images,
285 const std::vector<std::string>& blob_uuids);
275 }; 286 };
276 287
277 } // namespace extensions 288 } // namespace extensions
278 289
279 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ 290 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698