Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 // renderer process. It is created on the UI thread. Messages may be handled on | 31 // renderer process. It is created on the UI thread. Messages may be handled on |
| 32 // the IO thread or the UI thread. | 32 // the IO thread or the UI thread. |
| 33 class ExtensionMessageFilter : public content::BrowserMessageFilter { | 33 class ExtensionMessageFilter : public content::BrowserMessageFilter { |
| 34 public: | 34 public: |
| 35 ExtensionMessageFilter(int render_process_id, | 35 ExtensionMessageFilter(int render_process_id, |
| 36 content::BrowserContext* context); | 36 content::BrowserContext* context); |
| 37 | 37 |
| 38 int render_process_id() { return render_process_id_; } | 38 int render_process_id() { return render_process_id_; } |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 friend class content::BrowserThread; | |
| 42 friend class base::DeleteHelper<ExtensionMessageFilter>; | |
| 43 | |
| 41 virtual ~ExtensionMessageFilter(); | 44 virtual ~ExtensionMessageFilter(); |
| 42 | 45 |
| 43 // content::BrowserMessageFilter implementation. | 46 // content::BrowserMessageFilter implementation. |
| 44 virtual void OverrideThreadForMessage( | 47 virtual void OverrideThreadForMessage( |
| 45 const IPC::Message& message, | 48 const IPC::Message& message, |
| 46 content::BrowserThread::ID* thread) OVERRIDE; | 49 content::BrowserThread::ID* thread) OVERRIDE; |
| 50 virtual void OnDestruct() const OVERRIDE; | |
| 47 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 51 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 48 | 52 |
| 49 // Message handlers on the UI thread. | 53 // Message handlers on the UI thread. |
| 50 void OnExtensionAddListener(const std::string& extension_id, | 54 void OnExtensionAddListener(const std::string& extension_id, |
| 51 const std::string& event_name); | 55 const std::string& event_name); |
| 52 void OnExtensionRemoveListener(const std::string& extension_id, | 56 void OnExtensionRemoveListener(const std::string& extension_id, |
| 53 const std::string& event_name); | 57 const std::string& event_name); |
| 54 void OnExtensionAddLazyListener(const std::string& extension_id, | 58 void OnExtensionAddLazyListener(const std::string& extension_id, |
| 55 const std::string& event_name); | 59 const std::string& event_name); |
| 56 void OnExtensionRemoveLazyListener(const std::string& extension_id, | 60 void OnExtensionRemoveLazyListener(const std::string& extension_id, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 75 int routing_id, | 79 int routing_id, |
| 76 const ExtensionHostMsg_Request_Params& params); | 80 const ExtensionHostMsg_Request_Params& params); |
| 77 | 81 |
| 78 const int render_process_id_; | 82 const int render_process_id_; |
| 79 | 83 |
| 80 // Should only be accessed on the UI thread. | 84 // Should only be accessed on the UI thread. |
| 81 content::BrowserContext* browser_context_; | 85 content::BrowserContext* browser_context_; |
| 82 | 86 |
| 83 scoped_refptr<extensions::InfoMap> extension_info_map_; | 87 scoped_refptr<extensions::InfoMap> extension_info_map_; |
| 84 | 88 |
| 85 base::WeakPtrFactory<ExtensionMessageFilter> weak_ptr_factory_; | 89 base::WeakPtrFactory<ExtensionMessageFilter> weak_ptr_factory_; |
|
James Cook
2014/06/02 19:50:43
Document that these weak pointers are bound to the
Daniel Erat
2014/06/02 20:07:59
Done.
| |
| 86 | 90 |
| 87 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageFilter); | 91 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageFilter); |
| 88 }; | 92 }; |
| 89 | 93 |
| 90 } // namespace extensions | 94 } // namespace extensions |
| 91 | 95 |
| 92 #endif // EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ | 96 #endif // EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ |
| OLD | NEW |