pepper_flash_drm_host.h revision 7dbb3d5cf0c15f500944d211057644d6a2f37371
1736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov// Use of this source code is governed by a BSD-style license that can be
3736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov// found in the LICENSE file.
4736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
5736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_DRM_HOST_H_
6736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov#define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_DRM_HOST_H_
7736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
8736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov#include <string>
9736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
10736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov#include "base/memory/weak_ptr.h"
11736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov#include "chrome/browser/renderer_host/pepper/device_id_fetcher.h"
12736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov#include "ppapi/host/host_message_context.h"
13736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov#include "ppapi/host/resource_host.h"
14736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
15736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganovnamespace content {
16736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganovclass BrowserPpapiHost;
17736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov}
18736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
19736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganovnamespace IPC {
20736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganovclass Message;
21736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov}
22736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
23736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganovnamespace chrome {
24736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganovclass MonitorFinder;
25736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
26736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganovclass PepperFlashDRMHost : public ppapi::host::ResourceHost {
27736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov public:
28736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  PepperFlashDRMHost(content::BrowserPpapiHost* host,
29736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov                     PP_Instance instance,
30736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov                     PP_Resource resource);
31736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  virtual ~PepperFlashDRMHost();
32736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
33fe9f8ab03a63b1037f07dd85799fbea80ec6adaaJeff Brown  // ResourceHost override.
34736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  virtual int32_t OnResourceMessageReceived(
35736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov      const IPC::Message& msg,
36736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov      ppapi::host::HostMessageContext* context) OVERRIDE;
37736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
38736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov private:
39736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  // IPC message handler.
40736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  int32_t OnHostMsgGetDeviceID(ppapi::host::HostMessageContext* context);
41736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  int32_t OnHostMsgGetHmonitor(ppapi::host::HostMessageContext* context);
42736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
43736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  // Called by the fetcher when the device ID was retrieved, or the empty string
44736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  // on error.
45736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  void GotDeviceID(ppapi::host::ReplyMessageContext reply_context,
46736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov                   const std::string& id);
47736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
48736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  scoped_refptr<DeviceIDFetcher> fetcher_;
49736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  scoped_refptr<MonitorFinder> monitor_finder_;
50736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
51736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  base::WeakPtrFactory<PepperFlashDRMHost> weak_factory_;
52736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
53736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov  DISALLOW_COPY_AND_ASSIGN(PepperFlashDRMHost);
54736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov};
55736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
56736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov}  // namespace chrome
57736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
58736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov#endif  // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_DRM_HOST_H_
59736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov