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_BROWSER_RENDERER_HOST_PEPPER_PEPPER_BROKER_MESSAGE_FILTER_H_
6#define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_BROKER_MESSAGE_FILTER_H_
7
8#include "base/compiler_specific.h"
9#include "ppapi/c/pp_instance.h"
10#include "ppapi/host/resource_message_filter.h"
11#include "url/gurl.h"
12
13namespace content {
14class BrowserPpapiHost;
15}
16
17namespace ppapi {
18namespace host {
19struct HostMessageContext;
20}
21}
22
23namespace chrome {
24
25// This filter handles messages for the PepperBrokerHost on the UI thread.
26class PepperBrokerMessageFilter : public ppapi::host::ResourceMessageFilter {
27 public:
28  PepperBrokerMessageFilter(PP_Instance instance,
29                            content::BrowserPpapiHost* host);
30
31 private:
32  virtual ~PepperBrokerMessageFilter();
33
34  // ppapi::host::ResourceMessageFilter overrides.
35  virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
36      const IPC::Message& message) OVERRIDE;
37  virtual int32_t OnResourceMessageReceived(
38      const IPC::Message& msg,
39      ppapi::host::HostMessageContext* context) OVERRIDE;
40
41  int32_t OnIsAllowed(ppapi::host::HostMessageContext* context);
42
43  int render_process_id_;
44  GURL document_url_;
45
46  DISALLOW_COPY_AND_ASSIGN(PepperBrokerMessageFilter);
47};
48
49}  // namespace chrome
50
51#endif  // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_BROKER_MESSAGE_FILTER_H_
52