| 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 // 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 "chrome/common/media_galleries/metadata_types.h" |
| 22 #include "components/storage_monitor/media_storage_util.h" | 22 #include "components/storage_monitor/media_storage_util.h" |
| 23 #include "extensions/browser/browser_context_keyed_api_factory.h" | 23 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 24 | 24 |
| 25 namespace MediaGalleries = extensions::api::media_galleries; | 25 namespace MediaGalleries = extensions::api::media_galleries; |
| 26 | 26 |
| 27 class MediaGalleriesScanResultDialogController; | 27 class MediaGalleriesScanResultDialogController; |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 class BlobHandle; |
| 30 class WebContents; | 31 class WebContents; |
| 31 } | 32 } |
| 32 | 33 |
| 33 namespace metadata { | 34 namespace metadata { |
| 34 class SafeMediaMetadataParser; | 35 class SafeMediaMetadataParser; |
| 35 } | 36 } |
| 36 | 37 |
| 37 namespace extensions { | 38 namespace extensions { |
| 38 | 39 |
| 39 class Extension; | 40 class Extension; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 public: | 258 public: |
| 258 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMetadata", | 259 DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMetadata", |
| 259 MEDIAGALLERIES_GETMETADATA) | 260 MEDIAGALLERIES_GETMETADATA) |
| 260 | 261 |
| 261 protected: | 262 protected: |
| 262 virtual ~MediaGalleriesGetMetadataFunction(); | 263 virtual ~MediaGalleriesGetMetadataFunction(); |
| 263 virtual bool RunAsync() OVERRIDE; | 264 virtual bool RunAsync() OVERRIDE; |
| 264 | 265 |
| 265 private: | 266 private: |
| 266 // Bottom half for RunAsync, invoked after the preferences is initialized. | 267 // Bottom half for RunAsync, invoked after the preferences is initialized. |
| 267 void OnPreferencesInit(bool mime_type_only, const std::string& blob_uuid); | 268 void OnPreferencesInit(bool mime_type_only, bool get_attached_images, |
| 269 const std::string& blob_uuid); |
| 268 | 270 |
| 269 void SniffMimeType(bool mime_type_only, | 271 void GetMetadata(bool mime_type_only, bool get_attached_images, |
| 270 const std::string& blob_uuid, | 272 const std::string& blob_uuid, |
| 271 scoped_ptr<std::string> blob_header, | 273 scoped_ptr<std::string> blob_header, |
| 272 int64 total_blob_length); | 274 int64 total_blob_length); |
| 273 | 275 |
| 274 void OnSafeMediaMetadataParserDone( | 276 void OnSafeMediaMetadataParserDone( |
| 275 bool parse_success, scoped_ptr<base::DictionaryValue> metadata_dictionary, | 277 bool parse_success, scoped_ptr<base::DictionaryValue> metadata_dictionary, |
| 276 scoped_ptr<std::vector<metadata::AttachedImage> > attached_images); | 278 scoped_ptr<std::vector<metadata::AttachedImage> > attached_images); |
| 279 |
| 280 void ConstructNextBlob( |
| 281 scoped_ptr<base::DictionaryValue> metadata_dictionary, |
| 282 scoped_ptr<std::vector<metadata::AttachedImage> > attached_images, |
| 283 scoped_ptr<std::vector<std::string> > blob_uuids, |
| 284 scoped_ptr<content::BlobHandle> next_blob); |
| 285 |
| 286 void FinishRequest( |
| 287 scoped_ptr<base::DictionaryValue> metadata_dictionary, |
| 288 scoped_ptr<std::vector<metadata::AttachedImage> > attached_images, |
| 289 scoped_ptr<std::vector<std::string> > blob_uuids); |
| 277 }; | 290 }; |
| 278 | 291 |
| 279 } // namespace extensions | 292 } // namespace extensions |
| 280 | 293 |
| 281 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ | 294 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ |
| OLD | NEW |