summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_plugin/browser_plugin_guest_helper.h
blob: dfe2e321691cda838039ffca1692d0cbff35ab32 (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
// 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 CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_HELPER_H_
#define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_HELPER_H_

#include "content/port/common/input_event_ack_state.h"
#include "content/public/browser/render_view_host_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "third_party/WebKit/public/web/WebDragOperation.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"

class WebCursor;
#if defined(OS_MACOSX)
struct ViewHostMsg_ShowPopup_Params;
#endif
struct ViewHostMsg_UpdateRect_Params;

namespace gfx {
class Size;
}

namespace content {
class BrowserPluginGuest;
class RenderViewHost;

// Helper for BrowserPluginGuest.
//
// The purpose of this class is to intercept messages from the guest RenderView
// before they are handled by the standard message handlers in the browser
// process. This permits overriding standard behavior with BrowserPlugin-
// specific behavior.
//
// The lifetime of this class is managed by the associated RenderViewHost. A
// BrowserPluginGuestHelper is created whenever a BrowserPluginGuest is created.
class BrowserPluginGuestHelper : public RenderViewHostObserver {
 public:
  BrowserPluginGuestHelper(BrowserPluginGuest* guest,
                           RenderViewHost* render_view_host);
  virtual ~BrowserPluginGuestHelper();

 protected:
  // RenderViewHostObserver implementation.
  virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;

 private:
  // Returns whether a message should be forward to the helper's associated
  // BrowserPluginGuest.
  static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message);

  BrowserPluginGuest* guest_;

  DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuestHelper);
};

}  // namespace content

#endif  // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_HELPER_H_