Home | History | Annotate | Download | only in pepper
      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_RENDERER_HOST_H_
      6 #define CHROME_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_
      7 
      8 #include <string>
      9 #include <vector>
     10 
     11 #include "base/basictypes.h"
     12 #include "base/memory/weak_ptr.h"
     13 #include "ppapi/host/host_message_context.h"
     14 #include "ppapi/host/resource_host.h"
     15 
     16 struct PP_Rect;
     17 
     18 namespace ppapi {
     19 struct URLRequestInfoData;
     20 }
     21 
     22 namespace ppapi {
     23 namespace proxy {
     24 struct PPBFlash_DrawGlyphs_Params;
     25 }
     26 }
     27 
     28 namespace content {
     29 class RendererPpapiHost;
     30 }
     31 
     32 namespace chrome {
     33 
     34 class PepperFlashRendererHost : public ppapi::host::ResourceHost {
     35  public:
     36   PepperFlashRendererHost(content::RendererPpapiHost* host,
     37                           PP_Instance instance,
     38                           PP_Resource resource);
     39   virtual ~PepperFlashRendererHost();
     40 
     41   // ppapi::host::ResourceHost override.
     42   virtual int32_t OnResourceMessageReceived(
     43       const IPC::Message& msg,
     44       ppapi::host::HostMessageContext* context) OVERRIDE;
     45 
     46  private:
     47   int32_t OnGetProxyForURL(ppapi::host::HostMessageContext* host_context,
     48                            const std::string& url);
     49   int32_t OnSetInstanceAlwaysOnTop(
     50       ppapi::host::HostMessageContext* host_context,
     51       bool on_top);
     52   int32_t OnDrawGlyphs(ppapi::host::HostMessageContext* host_context,
     53                        ppapi::proxy::PPBFlash_DrawGlyphs_Params params);
     54   int32_t OnNavigate(ppapi::host::HostMessageContext* host_context,
     55                      const ppapi::URLRequestInfoData& data,
     56                      const std::string& target,
     57                         bool from_user_action);
     58   int32_t OnIsRectTopmost(ppapi::host::HostMessageContext* host_context,
     59                           const PP_Rect& rect);
     60   int32_t OnInvokePrinting(ppapi::host::HostMessageContext* host_context);
     61 
     62   base::WeakPtrFactory<PepperFlashRendererHost> weak_factory_;
     63   // A stack of ReplyMessageContexts to track Navigate() calls which have not
     64   // yet been replied to.
     65   std::vector<ppapi::host::ReplyMessageContext> navigate_replies_;
     66 
     67   content::RendererPpapiHost* host_;
     68 
     69   DISALLOW_COPY_AND_ASSIGN(PepperFlashRendererHost);
     70 };
     71 
     72 }  // namespace chrome
     73 
     74 #endif  // CHROME_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_
     75