Home | History | Annotate | Download | only in frame_host
      1 // Copyright 2013 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 CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_MESSAGE_FILTER_H_
      6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_MESSAGE_FILTER_H_
      7 
      8 #include "content/public/browser/browser_message_filter.h"
      9 
     10 namespace content {
     11 class RenderWidgetHelper;
     12 
     13 // RenderFrameMessageFilter intercepts FrameHost messages on the IO thread
     14 // that require low-latency processing. The canonical example of this is
     15 // child-frame creation which is a sync IPC that provides the renderer
     16 // with the routing id for a newly created RenderFrame.
     17 //
     18 // This object is created on the UI thread and used on the IO thread.
     19 class RenderFrameMessageFilter : public BrowserMessageFilter {
     20  public:
     21   RenderFrameMessageFilter(int render_process_id,
     22                            RenderWidgetHelper* render_widget_helper);
     23 
     24   virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
     25 
     26  private:
     27   virtual ~RenderFrameMessageFilter();
     28 
     29   void OnCreateChildFrame(int parent_routing_id,
     30                           const std::string& frame_name,
     31                           int* new_render_frame_id);
     32 
     33   const int render_process_id_;
     34 
     35   // Needed for issuing routing ids and surface ids.
     36   scoped_refptr<RenderWidgetHelper> render_widget_helper_;
     37 };
     38 
     39 }  // namespace content
     40 
     41 #endif  // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_MESSAGE_FILTER_H_
     42