pepper_flash_drm_host.h revision 90dce4d38c5ff5333bea97d859d4e484e27edf0c
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_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_DRM_HOST_H_
6#define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_DRM_HOST_H_
7
8#include <string>
9
10#include "base/memory/weak_ptr.h"
11#include "chrome/browser/renderer_host/pepper/device_id_fetcher.h"
12#include "ppapi/host/host_message_context.h"
13#include "ppapi/host/resource_host.h"
14
15namespace content {
16class BrowserPpapiHost;
17}
18
19namespace IPC {
20class Message;
21}
22
23namespace chrome {
24
25class PepperFlashDRMHost : public ppapi::host::ResourceHost {
26 public:
27  PepperFlashDRMHost(content::BrowserPpapiHost* host,
28                     PP_Instance instance,
29                     PP_Resource resource);
30  virtual ~PepperFlashDRMHost();
31
32  // ResourceHost override.
33  virtual int32_t OnResourceMessageReceived(
34      const IPC::Message& msg,
35      ppapi::host::HostMessageContext* context) OVERRIDE;
36
37 private:
38  // IPC message handler.
39  int32_t OnHostMsgGetDeviceID(ppapi::host::HostMessageContext* context);
40
41  // Called by the fetcher when the device ID was retrieved, or the empty string
42  // on error.
43  void GotDeviceID(ppapi::host::ReplyMessageContext reply_context,
44                   const std::string& id);
45
46  scoped_refptr<DeviceIDFetcher> fetcher_;
47
48  base::WeakPtrFactory<PepperFlashDRMHost> weak_factory_;
49
50  DISALLOW_COPY_AND_ASSIGN(PepperFlashDRMHost);
51};
52
53}  // namespace chrome
54
55#endif  // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_DRM_HOST_H_
56