OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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 EXTENSIONS_BROWSER_IO_THREAD_EXTENSION_MESSAGE_FILTER_H_ | |
6 #define EXTENSIONS_BROWSER_IO_THREAD_EXTENSION_MESSAGE_FILTER_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "content/public/browser/browser_message_filter.h" | |
12 | |
13 struct ExtensionHostMsg_Request_Params; | |
14 | |
15 namespace content { | |
16 class BrowserContext; | |
17 } | |
18 | |
19 namespace extensions { | |
20 | |
21 class InfoMap; | |
22 | |
23 // This class filters out incoming extension-specific IPC messages from the | |
24 // renderer process. It is created on the UI thread, but handles messages on the | |
25 // IO thread and is destroyed there. | |
26 class IOThreadExtensionMessageFilter : public content::BrowserMessageFilter { | |
27 public: | |
28 IOThreadExtensionMessageFilter(int render_process_id, | |
29 content::BrowserContext* context); | |
30 | |
31 int render_process_id() { return render_process_id_; } | |
not at google - send to devlin
2015/02/10 18:37:15
Where is this called from?
Bernhard Bauer
2015/02/10 19:02:34
WebRequestInternalAddEventListenerFunction::RunSyn
| |
32 | |
33 private: | |
34 friend class base::DeleteHelper<IOThreadExtensionMessageFilter>; | |
35 friend class content::BrowserThread; | |
36 | |
37 ~IOThreadExtensionMessageFilter() override; | |
38 | |
39 // content::BrowserMessageFilter implementation. | |
40 void OnDestruct() const override; | |
41 bool OnMessageReceived(const IPC::Message& message) override; | |
42 | |
43 // Message handlers on the IO thread. | |
44 void OnExtensionGenerateUniqueID(int* unique_id); | |
45 void OnExtensionResumeRequests(int route_id); | |
46 void OnExtensionRequestForIOThread( | |
47 int routing_id, | |
48 const ExtensionHostMsg_Request_Params& params); | |
49 | |
50 const int render_process_id_; | |
51 | |
52 // The browser context as a void pointer, for use as an identifier on the IO | |
53 // thread. | |
54 void* browser_context_id_; | |
55 | |
56 scoped_refptr<extensions::InfoMap> extension_info_map_; | |
57 | |
58 // Weak pointers produced by this factory are bound to the IO thread. | |
59 base::WeakPtrFactory<IOThreadExtensionMessageFilter> weak_ptr_factory_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(IOThreadExtensionMessageFilter); | |
62 }; | |
63 | |
64 } // namespace extensions | |
65 | |
66 #endif // EXTENSIONS_BROWSER_IO_THREAD_EXTENSION_MESSAGE_FILTER_H_ | |
OLD | NEW |