Fix import error in mac_platform_backend.py
[chromium-blink-merge.git] / extensions / browser / extension_message_filter.h
blob8518bf9e81591dfd79bcbdc23017454640a872cb
1 // Copyright 2014 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.
5 #ifndef EXTENSIONS_BROWSER_EXTENSION_RENDER_MESSAGE_FILTER_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_RENDER_MESSAGE_FILTER_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "content/public/browser/browser_message_filter.h"
14 namespace base {
15 class DictionaryValue;
18 namespace content {
19 class BrowserContext;
22 namespace extensions {
24 // This class filters out incoming extension-specific IPC messages from the
25 // renderer process. It is created on the UI thread. Messages may be handled on
26 // the IO thread or the UI thread.
27 class ExtensionMessageFilter : public content::BrowserMessageFilter {
28 public:
29 ExtensionMessageFilter(int render_process_id,
30 content::BrowserContext* context);
32 private:
33 virtual ~ExtensionMessageFilter();
35 // content::BrowserMessageFilter implementation.
36 virtual void OverrideThreadForMessage(
37 const IPC::Message& message,
38 content::BrowserThread::ID* thread) OVERRIDE;
39 virtual bool OnMessageReceived(const IPC::Message& message,
40 bool* message_was_ok) OVERRIDE;
42 // Message handlers on the UI thread.
43 void OnExtensionAddListener(const std::string& extension_id,
44 const std::string& event_name);
45 void OnExtensionRemoveListener(const std::string& extension_id,
46 const std::string& event_name);
47 void OnExtensionAddLazyListener(const std::string& extension_id,
48 const std::string& event_name);
49 void OnExtensionRemoveLazyListener(const std::string& extension_id,
50 const std::string& event_name);
51 void OnExtensionAddFilteredListener(const std::string& extension_id,
52 const std::string& event_name,
53 const base::DictionaryValue& filter,
54 bool lazy);
55 void OnExtensionRemoveFilteredListener(const std::string& extension_id,
56 const std::string& event_name,
57 const base::DictionaryValue& filter,
58 bool lazy);
59 void OnExtensionShouldSuspendAck(const std::string& extension_id,
60 int sequence_id);
61 void OnExtensionSuspendAck(const std::string& extension_id);
63 // Message handlers on the IO thread.
64 void OnExtensionGenerateUniqueID(int* unique_id);
65 void OnExtensionResumeRequests(int route_id);
67 const int render_process_id_;
69 // Should only be accessed on the UI thread.
70 content::BrowserContext* browser_context_;
72 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageFilter);
75 } // namespace extensions
77 #endif // EXTENSIONS_BROWSER_EXTENSION_RENDER_MESSAGE_FILTER_H_