| OLD | NEW | 
|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef MEDIA_BASE_ANDROID_MEDIA_RESOURCE_GETTER_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_RESOURCE_GETTER_H_ | 
| 6 #define MEDIA_BASE_ANDROID_MEDIA_RESOURCE_GETTER_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_RESOURCE_GETTER_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/callback.h" | 10 #include "base/callback.h" | 
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" | 
|  | 12 #include "base/strings/string16.h" | 
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" | 
| 13 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" | 
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" | 
| 15 | 16 | 
| 16 namespace media { | 17 namespace media { | 
| 17 | 18 | 
| 18 // Class for asynchronously retrieving resources for a media URL. All callbacks | 19 // Class for asynchronously retrieving resources for a media URL. All callbacks | 
| 19 // are executed on the caller's thread. | 20 // are executed on the caller's thread. | 
| 20 class MEDIA_EXPORT MediaResourceGetter { | 21 class MEDIA_EXPORT MediaResourceGetter { | 
| 21  public: | 22  public: | 
|  | 23   // Callback to get the cookies. Args: cookies string. | 
| 22   typedef base::Callback<void(const std::string&)> GetCookieCB; | 24   typedef base::Callback<void(const std::string&)> GetCookieCB; | 
|  | 25 | 
|  | 26   // Callback to get the platform path. Args: platform path. | 
| 23   typedef base::Callback<void(const std::string&)> GetPlatformPathCB; | 27   typedef base::Callback<void(const std::string&)> GetPlatformPathCB; | 
|  | 28 | 
|  | 29   // Callback to get the auth credentials. Args: username and password. | 
|  | 30   typedef base::Callback<void(const base::string16&, const base::string16&)> | 
|  | 31       GetAuthCredentialsCB; | 
|  | 32 | 
|  | 33   // Callback to get the media metadata. Args: duration, width, height, and | 
|  | 34   // whether the information is retrieved successfully. | 
| 24   typedef base::Callback<void(base::TimeDelta, int, int, bool)> | 35   typedef base::Callback<void(base::TimeDelta, int, int, bool)> | 
| 25       ExtractMediaMetadataCB; | 36       ExtractMediaMetadataCB; | 
| 26   virtual ~MediaResourceGetter(); | 37   virtual ~MediaResourceGetter(); | 
| 27 | 38 | 
|  | 39   // Method for getting the auth credentials for a URL. | 
|  | 40   virtual void GetAuthCredentials(const GURL& url, | 
|  | 41                                   const GetAuthCredentialsCB& callback) = 0; | 
|  | 42 | 
| 28   // Method for getting the cookies for a given URL. | 43   // Method for getting the cookies for a given URL. | 
| 29   virtual void GetCookies(const GURL& url, | 44   virtual void GetCookies(const GURL& url, | 
| 30                           const GURL& first_party_for_cookies, | 45                           const GURL& first_party_for_cookies, | 
| 31                           const GetCookieCB& callback) = 0; | 46                           const GetCookieCB& callback) = 0; | 
| 32 | 47 | 
| 33   // Method for getting the platform path from a file system or blob URL. | 48   // Method for getting the platform path from a file system or blob URL. | 
| 34   virtual void GetPlatformPathFromURL( | 49   virtual void GetPlatformPathFromURL( | 
| 35       const GURL& url, | 50       const GURL& url, | 
| 36       const GetPlatformPathCB& callback) = 0; | 51       const GetPlatformPathCB& callback) = 0; | 
| 37 | 52 | 
| 38   // Extract the metadata from a media URL. Once completed, the provided | 53   // Extract the metadata from a media URL. Once completed, the provided | 
| 39   // callback function will be run. | 54   // callback function will be run. | 
| 40   virtual void ExtractMediaMetadata( | 55   virtual void ExtractMediaMetadata( | 
| 41       const std::string& url, | 56       const std::string& url, | 
| 42       const std::string& cookies, | 57       const std::string& cookies, | 
| 43       const std::string& user_agent, | 58       const std::string& user_agent, | 
| 44       const ExtractMediaMetadataCB& callback) = 0; | 59       const ExtractMediaMetadataCB& callback) = 0; | 
| 45 }; | 60 }; | 
| 46 | 61 | 
| 47 }  // namespace media | 62 }  // namespace media | 
| 48 | 63 | 
| 49 #endif  // MEDIA_BASE_ANDROID_MEDIA_RESOURCE_GETTER_H_ | 64 #endif  // MEDIA_BASE_ANDROID_MEDIA_RESOURCE_GETTER_H_ | 
| OLD | NEW | 
|---|