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
3 // found in the LICENSE file.
5 #ifndef MEDIA_BASE_ANDROID_MEDIA_RESOURCE_GETTER_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_RESOURCE_GETTER_H_
10 #include "base/callback.h"
11 #include "base/files/file_path.h"
12 #include "base/strings/string16.h"
13 #include "base/time/time.h"
14 #include "media/base/media_export.h"
19 // Class for asynchronously retrieving resources for a media URL. All callbacks
20 // are executed on the caller's thread.
21 class MEDIA_EXPORT MediaResourceGetter
{
23 // Callback to get the cookies. Args: cookies string.
24 typedef base::Callback
<void(const std::string
&)> GetCookieCB
;
26 // Callback to get the platform path. Args: platform path.
27 typedef base::Callback
<void(const std::string
&)> GetPlatformPathCB
;
29 // Callback to get the auth credentials. Args: username and password.
30 typedef base::Callback
<void(const base::string16
&, const base::string16
&)>
33 // Callback to get the media metadata. Args: duration, width, height, and
34 // whether the information is retrieved successfully.
35 typedef base::Callback
<void(base::TimeDelta
, int, int, bool)>
36 ExtractMediaMetadataCB
;
37 virtual ~MediaResourceGetter();
39 // Method for getting the auth credentials for a URL.
40 virtual void GetAuthCredentials(const GURL
& url
,
41 const GetAuthCredentialsCB
& callback
) = 0;
43 // Method for getting the cookies for a given URL.
44 virtual void GetCookies(const GURL
& url
,
45 const GURL
& first_party_for_cookies
,
46 const GetCookieCB
& callback
) = 0;
48 // Method for getting the platform path from a file system or blob URL.
49 virtual void GetPlatformPathFromURL(
51 const GetPlatformPathCB
& callback
) = 0;
53 // Extracts the metadata from a media URL. Once completed, the provided
54 // callback function will be run.
55 virtual void ExtractMediaMetadata(
56 const std::string
& url
,
57 const std::string
& cookies
,
58 const std::string
& user_agent
,
59 const ExtractMediaMetadataCB
& callback
) = 0;
61 // Extracts the metadata from a file descriptor. Once completed, the
62 // provided callback function will be run.
63 virtual void ExtractMediaMetadata(
67 const ExtractMediaMetadataCB
& callback
) = 0;
72 #endif // MEDIA_BASE_ANDROID_MEDIA_RESOURCE_GETTER_H_