summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ppapi_plugin_process_host.h
blob: 227cf31e0911cd06b57d4c8bd3ab92417ae913b9 (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) 2010 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_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
#define CHROME_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
#pragma once

#include "base/basictypes.h"
#include "base/file_path.h"
#include "chrome/browser/browser_child_process_host.h"

class RenderMessageFilter;

class PpapiPluginProcessHost : public BrowserChildProcessHost {
 public:
  explicit PpapiPluginProcessHost(RenderMessageFilter* filter);
  virtual ~PpapiPluginProcessHost();

  void Init(const FilePath& path, IPC::Message* reply_msg);

 private:
  virtual bool CanShutdown();
  virtual void OnProcessLaunched();

  virtual bool OnMessageReceived(const IPC::Message& msg);
  virtual void OnChannelConnected(int32 peer_pid);
  virtual void OnChannelError();

  // IPC message handlers.
  void OnPluginLoaded(const IPC::ChannelHandle& handle);

  // Sends the reply_msg_ to the renderer with the given channel info.
  void ReplyToRenderer(base::ProcessHandle plugin_handle,
                       const IPC::ChannelHandle& channel_handle);

  RenderMessageFilter* filter_;

  // Path to the plugin library.
  FilePath plugin_path_;

  // When we're waiting for initialization of the plugin, this contains the
  // reply message for the renderer to tell it that it can continue.
  scoped_ptr<IPC::Message> reply_msg_;

  DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost);
};

#endif  // CHROME_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_