OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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. | |
4 | |
5 #ifndef MEDIA_BASE_ANDROID_PROVISION_FETCHER_H | |
6 #define MEDIA_BASE_ANDROID_PROVISION_FETCHER_H | |
7 | |
8 #include <string> | |
9 #include "base/callback.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "media/base/media_export.h" | |
12 | |
13 namespace media { | |
14 | |
15 class ProvisionFetcherFactory; | |
16 | |
17 // The interface to retrieve provision information for MediaDrmBridge. | |
18 class MEDIA_EXPORT ProvisionFetcher { | |
19 public: | |
20 // After provision information is retrieved this callback will be called | |
21 // with the provision response and a status flag (success/failure). | |
22 using ResponseCallback = | |
xhwang
2015/11/02 20:37:05
nit: in media/ code, we typically use CB for Callb
Tima Vaisburd
2015/11/05 02:24:07
Done.
| |
23 base::Callback<void(const std::string& response, bool success)>; | |
xhwang
2015/11/02 20:37:05
nit: usually we put the flag (success) as the firs
Tima Vaisburd
2015/11/05 02:24:07
Done.
| |
24 | |
25 virtual ~ProvisionFetcher() {} | |
26 | |
27 // Requests the provision information with |default_url| and |request_data| | |
28 // and calls |cb| callback with the response. The input parameters | |
29 // |default_url| and |request_data| corresponds to Java class | |
30 // MediaDrm.ProvisionRequest. In case of an error ResponseCallback | |
qinmin
2015/11/02 19:39:14
Fix the comments, seems something is missing here.
Tima Vaisburd
2015/11/05 02:24:07
Done.
| |
31 // The implementation is suppoed to talk to a provision server that | |
xhwang
2015/11/02 20:37:05
s/suppoed/supposed
s/provision server/provisionin
Tima Vaisburd
2015/11/05 02:24:07
I removed talks about implementation here.
| |
32 // |default_url| points to. | |
33 virtual void Retrieve(const std::string& default_url, | |
34 const std::string& request_data, | |
35 ResponseCallback cb) = 0; | |
qinmin
2015/11/02 19:39:14
const ResponseCallback&
xhwang
2015/11/02 20:37:05
nit: s/cb/response_cb
xhwang
2015/11/02 20:37:05
Can we guarantee that the |cb| is always fired asy
Tima Vaisburd
2015/11/05 02:24:07
Done.
Tima Vaisburd
2015/11/05 02:24:07
Done.
Tima Vaisburd
2015/11/05 02:24:07
Done.
| |
36 | |
37 static ProvisionFetcherFactory* GetFactory(); | |
38 static void SetFactory(ProvisionFetcherFactory* factory); | |
39 }; | |
40 | |
41 // The interface to ProvisionFetcher factory. | |
42 class MEDIA_EXPORT ProvisionFetcherFactory { | |
43 public: | |
44 virtual scoped_ptr<ProvisionFetcher> CreateFetcher() const = 0; | |
45 }; | |
46 | |
47 } // namespace media | |
48 | |
49 #endif // MEDIA_BASE_ANDROID_PROVISION_FETCHER_H | |
OLD | NEW |