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 #include "extensions/browser/extension_message_filter.h" | 5 #include "extensions/browser/extension_message_filter.h" |
6 | 6 |
7 #include "components/crx_file/id_util.h" | 7 #include "components/crx_file/id_util.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
10 #include "content/public/browser/resource_dispatcher_host.h" | 10 #include "content/public/browser/resource_dispatcher_host.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
39 } | 39 } |
40 | 40 |
41 void ExtensionMessageFilter::OverrideThreadForMessage( | 41 void ExtensionMessageFilter::OverrideThreadForMessage( |
42 const IPC::Message& message, | 42 const IPC::Message& message, |
43 BrowserThread::ID* thread) { | 43 BrowserThread::ID* thread) { |
44 switch (message.type()) { | 44 switch (message.type()) { |
45 case ExtensionHostMsg_AddListener::ID: | 45 case ExtensionHostMsg_AddListener::ID: |
46 case ExtensionHostMsg_AttachGuest::ID: | 46 case ExtensionHostMsg_AttachGuest::ID: |
47 case ExtensionHostMsg_RemoveListener::ID: | 47 case ExtensionHostMsg_RemoveListener::ID: |
48 case ExtensionHostMsg_AddLazyListener::ID: | 48 case ExtensionHostMsg_AddLazyListener::ID: |
49 case ExtensionHostMsg_CreateMimeHandlerViewGuest::ID: | |
49 case ExtensionHostMsg_RemoveLazyListener::ID: | 50 case ExtensionHostMsg_RemoveLazyListener::ID: |
50 case ExtensionHostMsg_AddFilteredListener::ID: | 51 case ExtensionHostMsg_AddFilteredListener::ID: |
51 case ExtensionHostMsg_RemoveFilteredListener::ID: | 52 case ExtensionHostMsg_RemoveFilteredListener::ID: |
52 case ExtensionHostMsg_ShouldSuspendAck::ID: | 53 case ExtensionHostMsg_ShouldSuspendAck::ID: |
53 case ExtensionHostMsg_SuspendAck::ID: | 54 case ExtensionHostMsg_SuspendAck::ID: |
54 case ExtensionHostMsg_TransferBlobsAck::ID: | 55 case ExtensionHostMsg_TransferBlobsAck::ID: |
55 *thread = BrowserThread::UI; | 56 *thread = BrowserThread::UI; |
56 break; | 57 break; |
57 default: | 58 default: |
58 break; | 59 break; |
(...skipping 10 matching lines...) Expand all Loading... | |
69 bool handled = true; | 70 bool handled = true; |
70 IPC_BEGIN_MESSAGE_MAP(ExtensionMessageFilter, message) | 71 IPC_BEGIN_MESSAGE_MAP(ExtensionMessageFilter, message) |
71 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AddListener, | 72 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AddListener, |
72 OnExtensionAddListener) | 73 OnExtensionAddListener) |
73 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveListener, | 74 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveListener, |
74 OnExtensionRemoveListener) | 75 OnExtensionRemoveListener) |
75 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AddLazyListener, | 76 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AddLazyListener, |
76 OnExtensionAddLazyListener) | 77 OnExtensionAddLazyListener) |
77 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AttachGuest, | 78 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AttachGuest, |
78 OnExtensionAttachGuest) | 79 OnExtensionAttachGuest) |
80 IPC_MESSAGE_HANDLER(ExtensionHostMsg_CreateMimeHandlerViewGuest, | |
81 OnExtensionCreateMimeHandlerViewGuest) | |
79 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveLazyListener, | 82 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveLazyListener, |
80 OnExtensionRemoveLazyListener) | 83 OnExtensionRemoveLazyListener) |
81 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AddFilteredListener, | 84 IPC_MESSAGE_HANDLER(ExtensionHostMsg_AddFilteredListener, |
82 OnExtensionAddFilteredListener) | 85 OnExtensionAddFilteredListener) |
83 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveFilteredListener, | 86 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveFilteredListener, |
84 OnExtensionRemoveFilteredListener) | 87 OnExtensionRemoveFilteredListener) |
85 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ShouldSuspendAck, | 88 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ShouldSuspendAck, |
86 OnExtensionShouldSuspendAck) | 89 OnExtensionShouldSuspendAck) |
87 IPC_MESSAGE_HANDLER(ExtensionHostMsg_SuspendAck, | 90 IPC_MESSAGE_HANDLER(ExtensionHostMsg_SuspendAck, |
88 OnExtensionSuspendAck) | 91 OnExtensionSuspendAck) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 if (!manager) | 163 if (!manager) |
161 return; | 164 return; |
162 | 165 |
163 manager->AttachGuest(render_process_id_, | 166 manager->AttachGuest(render_process_id_, |
164 routing_id, | 167 routing_id, |
165 element_instance_id, | 168 element_instance_id, |
166 guest_instance_id, | 169 guest_instance_id, |
167 params); | 170 params); |
168 } | 171 } |
169 | 172 |
173 void ExtensionMessageFilter::OnExtensionCreateMimeHandlerViewGuest( | |
174 int render_frame_id, | |
175 const std::string& embedder_url, | |
176 const std::string& mime_type, | |
177 int element_instance_id) { | |
178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
179 extensions::GuestViewManager* manager = | |
180 extensions::GuestViewManager::FromBrowserContext(browser_context_); | |
181 manager->CreateMimeHandlerViewGuest(render_process_id_, | |
Fady Samuel
2014/08/29 18:52:32
Do we have to create a new method in GuestViewMana
lazyboy
2014/08/29 22:08:25
I've moved the creation code here.
| |
182 render_frame_id, | |
183 embedder_url, | |
184 mime_type, | |
185 element_instance_id); | |
186 } | |
187 | |
170 void ExtensionMessageFilter::OnExtensionRemoveLazyListener( | 188 void ExtensionMessageFilter::OnExtensionRemoveLazyListener( |
171 const std::string& extension_id, const std::string& event_name) { | 189 const std::string& extension_id, const std::string& event_name) { |
172 EventRouter* router = EventRouter::Get(browser_context_); | 190 EventRouter* router = EventRouter::Get(browser_context_); |
173 if (!router) | 191 if (!router) |
174 return; | 192 return; |
175 router->RemoveLazyEventListener(event_name, extension_id); | 193 router->RemoveLazyEventListener(event_name, extension_id); |
176 } | 194 } |
177 | 195 |
178 void ExtensionMessageFilter::OnExtensionAddFilteredListener( | 196 void ExtensionMessageFilter::OnExtensionAddFilteredListener( |
179 const std::string& extension_id, | 197 const std::string& extension_id, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 ExtensionFunctionDispatcher::DispatchOnIOThread( | 264 ExtensionFunctionDispatcher::DispatchOnIOThread( |
247 extension_info_map_.get(), | 265 extension_info_map_.get(), |
248 browser_context_, | 266 browser_context_, |
249 render_process_id_, | 267 render_process_id_, |
250 weak_ptr_factory_.GetWeakPtr(), | 268 weak_ptr_factory_.GetWeakPtr(), |
251 routing_id, | 269 routing_id, |
252 params); | 270 params); |
253 } | 271 } |
254 | 272 |
255 } // namespace extensions | 273 } // namespace extensions |
OLD | NEW |