Chromium Code Reviews| Index: media/base/android/provision_fetcher.h |
| diff --git a/media/base/android/provision_fetcher.h b/media/base/android/provision_fetcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c88fe3826de432ff2f811f780a949924f9d7cae5 |
| --- /dev/null |
| +++ b/media/base/android/provision_fetcher.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_BASE_ANDROID_PROVISION_FETCHER_H |
| +#define MEDIA_BASE_ANDROID_PROVISION_FETCHER_H |
| + |
| +#include <string> |
| +#include "base/callback.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "media/base/media_export.h" |
| + |
| +namespace media { |
| + |
| +class ProvisionFetcherFactory; |
| + |
| +// The interface to retrieve provision information for MediaDrmBridge. |
| +class MEDIA_EXPORT ProvisionFetcher { |
| + public: |
| + // After provision information is retrieved this callback will be called |
| + // with the provision response and a status flag (success/failure). |
| + 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.
|
| + 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.
|
| + |
| + virtual ~ProvisionFetcher() {} |
| + |
| + // Requests the provision information with |default_url| and |request_data| |
| + // and calls |cb| callback with the response. The input parameters |
| + // |default_url| and |request_data| corresponds to Java class |
| + // 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.
|
| + // 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.
|
| + // |default_url| points to. |
| + virtual void Retrieve(const std::string& default_url, |
| + const std::string& request_data, |
| + 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.
|
| + |
| + static ProvisionFetcherFactory* GetFactory(); |
| + static void SetFactory(ProvisionFetcherFactory* factory); |
| +}; |
| + |
| +// The interface to ProvisionFetcher factory. |
| +class MEDIA_EXPORT ProvisionFetcherFactory { |
| + public: |
| + virtual scoped_ptr<ProvisionFetcher> CreateFetcher() const = 0; |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_BASE_ANDROID_PROVISION_FETCHER_H |