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
3// found in the LICENSE file.
4
5#ifndef CHROME_RENDERER_PEPPER_PEPPER_FLASH_DRM_RENDERER_HOST_H_
6#define CHROME_RENDERER_PEPPER_PEPPER_FLASH_DRM_RENDERER_HOST_H_
7
8#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "base/memory/weak_ptr.h"
11#include "ppapi/host/resource_host.h"
12
13namespace base {
14class FilePath;
15}
16
17namespace content {
18class RendererPpapiHost;
19}
20
21// TODO(raymes): This is only needed until we move FileRef resources to the
22// browser. After that, get rid of this class altogether.
23class PepperFlashDRMRendererHost : public ppapi::host::ResourceHost {
24 public:
25  PepperFlashDRMRendererHost(content::RendererPpapiHost* host,
26                             PP_Instance instance,
27                             PP_Resource resource);
28  virtual ~PepperFlashDRMRendererHost();
29
30  virtual int32_t OnResourceMessageReceived(
31      const IPC::Message& msg,
32      ppapi::host::HostMessageContext* context) OVERRIDE;
33
34 private:
35  int32_t OnGetVoucherFile(ppapi::host::HostMessageContext* context);
36
37  void DidCreateFileRefHosts(
38      const ppapi::host::ReplyMessageContext& reply_context,
39      const base::FilePath& external_path,
40      int renderer_pending_host_id,
41      const std::vector<int>& browser_pending_host_ids);
42
43  // Non-owning pointer.
44  content::RendererPpapiHost* renderer_ppapi_host_;
45
46  base::WeakPtrFactory<PepperFlashDRMRendererHost> weak_factory_;
47
48  DISALLOW_COPY_AND_ASSIGN(PepperFlashDRMRendererHost);
49};
50
51#endif  // CHROME_RENDERER_PEPPER_PEPPER_FLASH_DRM_RENDERER_HOST_H_
52