| 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 CHROME_BROWSER_RENDERER_HOST_CHROME_EXTENSION_MESSAGE_FILTER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_CHROME_EXTENSION_MESSAGE_FILTER_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_EXTENSION_MESSAGE_FILTER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_EXTENSION_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/sequenced_task_runner_helpers.h" | 10 #include "base/sequenced_task_runner_helpers.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 // This class filters out incoming Chrome-specific IPC messages from the | 30 // This class filters out incoming Chrome-specific IPC messages from the |
| 31 // extension process on the IPC thread. | 31 // extension process on the IPC thread. |
| 32 class ChromeExtensionMessageFilter : public content::BrowserMessageFilter, | 32 class ChromeExtensionMessageFilter : public content::BrowserMessageFilter, |
| 33 public content::NotificationObserver { | 33 public content::NotificationObserver { |
| 34 public: | 34 public: |
| 35 ChromeExtensionMessageFilter(int render_process_id, Profile* profile); | 35 ChromeExtensionMessageFilter(int render_process_id, Profile* profile); |
| 36 | 36 |
| 37 // content::BrowserMessageFilter methods: | 37 // content::BrowserMessageFilter methods: |
| 38 virtual bool OnMessageReceived(const IPC::Message& message) override; | 38 bool OnMessageReceived(const IPC::Message& message) override; |
| 39 virtual void OverrideThreadForMessage( | 39 void OverrideThreadForMessage(const IPC::Message& message, |
| 40 const IPC::Message& message, | 40 content::BrowserThread::ID* thread) override; |
| 41 content::BrowserThread::ID* thread) override; | 41 void OnDestruct() const override; |
| 42 virtual void OnDestruct() const override; | |
| 43 | 42 |
| 44 private: | 43 private: |
| 45 friend class content::BrowserThread; | 44 friend class content::BrowserThread; |
| 46 friend class base::DeleteHelper<ChromeExtensionMessageFilter>; | 45 friend class base::DeleteHelper<ChromeExtensionMessageFilter>; |
| 47 | 46 |
| 48 virtual ~ChromeExtensionMessageFilter(); | 47 ~ChromeExtensionMessageFilter() override; |
| 49 | 48 |
| 50 // TODO(jamescook): Move these functions into the extensions module. Ideally | 49 // TODO(jamescook): Move these functions into the extensions module. Ideally |
| 51 // this would be in extensions::ExtensionMessageFilter but that will require | 50 // this would be in extensions::ExtensionMessageFilter but that will require |
| 52 // resolving the MessageService and ActivityLog dependencies on src/chrome. | 51 // resolving the MessageService and ActivityLog dependencies on src/chrome. |
| 53 // http://crbug.com/339637 | 52 // http://crbug.com/339637 |
| 54 void OnOpenChannelToExtension(int routing_id, | 53 void OnOpenChannelToExtension(int routing_id, |
| 55 const ExtensionMsg_ExternalConnectionInfo& info, | 54 const ExtensionMsg_ExternalConnectionInfo& info, |
| 56 const std::string& channel_name, | 55 const std::string& channel_name, |
| 57 bool include_tls_channel_id, | 56 bool include_tls_channel_id, |
| 58 int* port_id); | 57 int* port_id); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const std::string& extension_id, | 93 const std::string& extension_id, |
| 95 const std::string& function_name); | 94 const std::string& function_name); |
| 96 void OnAddDOMActionToExtensionActivityLog( | 95 void OnAddDOMActionToExtensionActivityLog( |
| 97 const std::string& extension_id, | 96 const std::string& extension_id, |
| 98 const ExtensionHostMsg_DOMAction_Params& params); | 97 const ExtensionHostMsg_DOMAction_Params& params); |
| 99 void OnAddEventToExtensionActivityLog( | 98 void OnAddEventToExtensionActivityLog( |
| 100 const std::string& extension_id, | 99 const std::string& extension_id, |
| 101 const ExtensionHostMsg_APIActionOrEvent_Params& params); | 100 const ExtensionHostMsg_APIActionOrEvent_Params& params); |
| 102 | 101 |
| 103 // content::NotificationObserver implementation. | 102 // content::NotificationObserver implementation. |
| 104 virtual void Observe(int type, | 103 void Observe(int type, |
| 105 const content::NotificationSource& source, | 104 const content::NotificationSource& source, |
| 106 const content::NotificationDetails& details) override; | 105 const content::NotificationDetails& details) override; |
| 107 | 106 |
| 108 const int render_process_id_; | 107 const int render_process_id_; |
| 109 | 108 |
| 110 // The Profile associated with our renderer process. This should only be | 109 // The Profile associated with our renderer process. This should only be |
| 111 // accessed on the UI thread! Furthermore since this class is refcounted it | 110 // accessed on the UI thread! Furthermore since this class is refcounted it |
| 112 // may outlive |profile_|, so make sure to NULL check if in doubt; async | 111 // may outlive |profile_|, so make sure to NULL check if in doubt; async |
| 113 // calls and the like. | 112 // calls and the like. |
| 114 Profile* profile_; | 113 Profile* profile_; |
| 115 | 114 |
| 116 scoped_refptr<extensions::InfoMap> extension_info_map_; | 115 scoped_refptr<extensions::InfoMap> extension_info_map_; |
| 117 | 116 |
| 118 content::NotificationRegistrar notification_registrar_; | 117 content::NotificationRegistrar notification_registrar_; |
| 119 | 118 |
| 120 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionMessageFilter); | 119 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionMessageFilter); |
| 121 }; | 120 }; |
| 122 | 121 |
| 123 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_EXTENSION_MESSAGE_FILTER_H_ | 122 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_EXTENSION_MESSAGE_FILTER_H_ |
| OLD | NEW |