summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_plugin/browser_plugin_host_helper.h
blob: f96892b2a188fdba70ea793f13293c7e8ff5a77d (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
// 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_HOST_HELPER_H__
#define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_HELPER_H__
#pragma once

#include <string>

#include "content/public/browser/render_view_host_observer.h"

namespace gfx {
class Size;
}

namespace content {

class BrowserPluginHost;

// This class acts as a plumber helper for BrowserPluginHost. A lot
// of messages coming from guests need to know the guest's RenderViewHost.
// BrowserPluginHostHelper handles BrowserPluginHost messages and relays
// them with their associated RenderViewHosts to BrowserPluginHost where they
// will be handled.
class BrowserPluginHostHelper : public RenderViewHostObserver {
 public:
  BrowserPluginHostHelper(BrowserPluginHost* browser_plugin_host,
                          RenderViewHost* render_view_host);
  virtual ~BrowserPluginHostHelper();

 private:
  void OnConnectToChannel(const IPC::ChannelHandle& channel_handle);
  void OnNavigateGuestFromEmbedder(int container_instance_id,
                                   long long frame_id,
                                   const std::string& src);
  void OnResizeGuest(int width, int height);

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

  BrowserPluginHost* browser_plugin_host_;

  DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostHelper);
};

}  // namespace content

#endif  // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_HELPER_H__