summaryrefslogtreecommitdiff
path: root/chromium/chrome/renderer/pepper/pepper_flash_renderer_host.h
blob: 68c3156f9bfc5512ec4408c02435152dd5104b81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) 2012 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 CHROME_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_
#define CHROME_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_

#include <stdint.h>

#include <string>
#include <vector>

#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "ppapi/host/host_message_context.h"
#include "ppapi/host/resource_host.h"

struct PP_Rect;

namespace ppapi {
struct URLRequestInfoData;
}

namespace ppapi {
namespace proxy {
struct PPBFlash_DrawGlyphs_Params;
}
}

namespace content {
class RendererPpapiHost;
}

class PepperFlashRendererHost : public ppapi::host::ResourceHost {
 public:
  PepperFlashRendererHost(content::RendererPpapiHost* host,
                          PP_Instance instance,
                          PP_Resource resource);
  ~PepperFlashRendererHost() override;

  // ppapi::host::ResourceHost override.
  int32_t OnResourceMessageReceived(
      const IPC::Message& msg,
      ppapi::host::HostMessageContext* context) override;

 private:
  int32_t OnGetProxyForURL(ppapi::host::HostMessageContext* host_context,
                           const std::string& url);
  int32_t OnSetInstanceAlwaysOnTop(
      ppapi::host::HostMessageContext* host_context,
      bool on_top);
  int32_t OnDrawGlyphs(ppapi::host::HostMessageContext* host_context,
                       ppapi::proxy::PPBFlash_DrawGlyphs_Params params);
  int32_t OnNavigate(ppapi::host::HostMessageContext* host_context,
                     const ppapi::URLRequestInfoData& data,
                     const std::string& target,
                     bool from_user_action);
  int32_t OnIsRectTopmost(ppapi::host::HostMessageContext* host_context,
                          const PP_Rect& rect);
  int32_t OnInvokePrinting(ppapi::host::HostMessageContext* host_context);

  // A stack of ReplyMessageContexts to track Navigate() calls which have not
  // yet been replied to.
  std::vector<ppapi::host::ReplyMessageContext> navigate_replies_;

  content::RendererPpapiHost* host_;
  base::WeakPtrFactory<PepperFlashRendererHost> weak_factory_{this};

  DISALLOW_COPY_AND_ASSIGN(PepperFlashRendererHost);
};

#endif  // CHROME_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_