#include "base/sequenced_task_runner_helpers.h"
#include "content/public/browser/browser_message_filter.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
class GURL;
class Profile;
namespace extensions {
class InfoMap;
+struct Message;
}
// This class filters out incoming Chrome-specific IPC messages from the
// extension process on the IPC thread.
-class ChromeExtensionMessageFilter : public content::BrowserMessageFilter {
+class ChromeExtensionMessageFilter : public content::BrowserMessageFilter,
+ public content::NotificationObserver {
public:
ChromeExtensionMessageFilter(int render_process_id, Profile* profile);
virtual void OverrideThreadForMessage(
const IPC::Message& message,
content::BrowserThread::ID* thread) OVERRIDE;
+ virtual void OnDestruct() const OVERRIDE;
private:
friend class content::BrowserThread;
int receiver_port_id,
int tab_id, const std::string& extension_id,
const std::string& channel_name);
+ void OnPostMessage(int port_id, const extensions::Message& message);
void OnGetExtMessageBundle(const std::string& extension_id,
IPC::Message* reply_msg);
void OnGetExtMessageBundleOnBlockingPool(
const std::string& extension_id,
const ExtensionHostMsg_APIActionOrEvent_Params& params);
+ // content::NotificationObserver implementation.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
const int render_process_id_;
// The Profile associated with our renderer process. This should only be
- // accessed on the UI thread!
+ // accessed on the UI thread! Furthermore since this class is refcounted it
+ // may outlive |profile_|, so make sure to NULL check if in doubt; async
+ // calls and the like.
Profile* profile_;
scoped_refptr<extensions::InfoMap> extension_info_map_;
+ content::NotificationRegistrar notification_registrar_;
+
DISALLOW_COPY_AND_ASSIGN(ChromeExtensionMessageFilter);
};