| 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 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "content/public/browser/browser_message_filter.h" | 14 #include "content/public/browser/browser_message_filter.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 | 16 |
| 17 struct ExtensionHostMsg_Request_Params; | 17 struct ExtensionHostMsg_Request_Params; |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class DictionaryValue; | 20 class DictionaryValue; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class BrowserContext; | 24 class BrowserContext; |
| 25 class WebContents; | 25 class WebContents; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace gfx { |
| 29 class Size; |
| 30 } |
| 31 |
| 28 namespace extensions { | 32 namespace extensions { |
| 29 | 33 |
| 30 class InfoMap; | 34 class InfoMap; |
| 31 | 35 |
| 32 // This class filters out incoming extension-specific IPC messages from the | 36 // This class filters out incoming extension-specific IPC messages from the |
| 33 // renderer process. It is created on the UI thread. Messages may be handled on | 37 // renderer process. It is created on the UI thread. Messages may be handled on |
| 34 // the IO thread or the UI thread. | 38 // the IO thread or the UI thread. |
| 35 class ExtensionMessageFilter : public content::BrowserMessageFilter { | 39 class ExtensionMessageFilter : public content::BrowserMessageFilter { |
| 36 public: | 40 public: |
| 37 ExtensionMessageFilter(int render_process_id, | 41 ExtensionMessageFilter(int render_process_id, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 59 const GURL& listener_url, | 63 const GURL& listener_url, |
| 60 const std::string& event_name); | 64 const std::string& event_name); |
| 61 void OnExtensionAddLazyListener(const std::string& extension_id, | 65 void OnExtensionAddLazyListener(const std::string& extension_id, |
| 62 const std::string& event_name); | 66 const std::string& event_name); |
| 63 void OnExtensionAttachGuest(int routing_id, | 67 void OnExtensionAttachGuest(int routing_id, |
| 64 int element_instance_id, | 68 int element_instance_id, |
| 65 int guest_instance_id, | 69 int guest_instance_id, |
| 66 const base::DictionaryValue& attach_params); | 70 const base::DictionaryValue& attach_params); |
| 67 void OnExtensionCreateMimeHandlerViewGuest(int render_frame_id, | 71 void OnExtensionCreateMimeHandlerViewGuest(int render_frame_id, |
| 68 const std::string& view_id, | 72 const std::string& view_id, |
| 69 int element_instance_id); | 73 int element_instance_id, |
| 74 const gfx::Size& element_size); |
| 70 void OnExtensionRemoveLazyListener(const std::string& extension_id, | 75 void OnExtensionRemoveLazyListener(const std::string& extension_id, |
| 71 const std::string& event_name); | 76 const std::string& event_name); |
| 72 void OnExtensionAddFilteredListener(const std::string& extension_id, | 77 void OnExtensionAddFilteredListener(const std::string& extension_id, |
| 73 const std::string& event_name, | 78 const std::string& event_name, |
| 74 const base::DictionaryValue& filter, | 79 const base::DictionaryValue& filter, |
| 75 bool lazy); | 80 bool lazy); |
| 76 void OnExtensionRemoveFilteredListener(const std::string& extension_id, | 81 void OnExtensionRemoveFilteredListener(const std::string& extension_id, |
| 77 const std::string& event_name, | 82 const std::string& event_name, |
| 78 const base::DictionaryValue& filter, | 83 const base::DictionaryValue& filter, |
| 79 bool lazy); | 84 bool lazy); |
| 80 void OnExtensionShouldSuspendAck(const std::string& extension_id, | 85 void OnExtensionShouldSuspendAck(const std::string& extension_id, |
| 81 int sequence_id); | 86 int sequence_id); |
| 82 void OnExtensionSuspendAck(const std::string& extension_id); | 87 void OnExtensionSuspendAck(const std::string& extension_id); |
| 83 void OnExtensionTransferBlobsAck(const std::vector<std::string>& blob_uuids); | 88 void OnExtensionTransferBlobsAck(const std::vector<std::string>& blob_uuids); |
| 84 | 89 |
| 85 // Message handlers on the IO thread. | 90 // Message handlers on the IO thread. |
| 86 void OnExtensionGenerateUniqueID(int* unique_id); | 91 void OnExtensionGenerateUniqueID(int* unique_id); |
| 87 void OnExtensionResumeRequests(int route_id); | 92 void OnExtensionResumeRequests(int route_id); |
| 88 void OnExtensionRequestForIOThread( | 93 void OnExtensionRequestForIOThread( |
| 89 int routing_id, | 94 int routing_id, |
| 90 const ExtensionHostMsg_Request_Params& params); | 95 const ExtensionHostMsg_Request_Params& params); |
| 91 | 96 |
| 92 // Runs on UI thread. | 97 // Runs on UI thread. |
| 93 void MimeHandlerViewGuestCreatedCallback(int element_instance_id, | 98 void MimeHandlerViewGuestCreatedCallback(int element_instance_id, |
| 94 int embedder_render_process_id, | 99 int embedder_render_process_id, |
| 95 int embedder_render_frame_id, | 100 int embedder_render_frame_id, |
| 101 const gfx::Size& element_size, |
| 96 content::WebContents* web_contents); | 102 content::WebContents* web_contents); |
| 97 | 103 |
| 98 const int render_process_id_; | 104 const int render_process_id_; |
| 99 | 105 |
| 100 // Should only be accessed on the UI thread. | 106 // Should only be accessed on the UI thread. |
| 101 content::BrowserContext* browser_context_; | 107 content::BrowserContext* browser_context_; |
| 102 | 108 |
| 103 scoped_refptr<extensions::InfoMap> extension_info_map_; | 109 scoped_refptr<extensions::InfoMap> extension_info_map_; |
| 104 | 110 |
| 105 // Weak pointers produced by this factory are bound to the IO thread. | 111 // Weak pointers produced by this factory are bound to the IO thread. |
| 106 base::WeakPtrFactory<ExtensionMessageFilter> weak_ptr_factory_; | 112 base::WeakPtrFactory<ExtensionMessageFilter> weak_ptr_factory_; |
| 107 | 113 |
| 108 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageFilter); | 114 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageFilter); |
| 109 }; | 115 }; |
| 110 | 116 |
| 111 } // namespace extensions | 117 } // namespace extensions |
| 112 | 118 |
| 113 #endif // EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ | 119 #endif // EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ |
| OLD | NEW |