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 "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "components/crx_file/id_util.h" | 9 #include "components/crx_file/id_util.h" |
10 #include "components/keyed_service/content/browser_context_keyed_service_shutdow n_notifier_factory.h" | 10 #include "components/keyed_service/content/browser_context_keyed_service_shutdow n_notifier_factory.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
13 #include "extensions/browser/blob_holder.h" | 13 #include "extensions/browser/blob_holder.h" |
14 #include "extensions/browser/event_router.h" | 14 #include "extensions/browser/event_router.h" |
15 #include "extensions/browser/event_router_factory.h" | 15 #include "extensions/browser/event_router_factory.h" |
16 #include "extensions/browser/extension_registry.h" | 16 #include "extensions/browser/extension_registry.h" |
17 #include "extensions/browser/process_manager.h" | 17 #include "extensions/browser/process_manager.h" |
18 #include "extensions/browser/process_manager_factory.h" | 18 #include "extensions/browser/process_manager_factory.h" |
19 #include "extensions/browser/process_map.h" | 19 #include "extensions/browser/process_map.h" |
20 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
21 #include "extensions/common/extension_api.h" | |
21 #include "extensions/common/extension_messages.h" | 22 #include "extensions/common/extension_messages.h" |
22 #include "extensions/common/manifest_handlers/background_info.h" | 23 #include "extensions/common/manifest_handlers/background_info.h" |
23 #include "ipc/ipc_message_macros.h" | 24 #include "ipc/ipc_message_macros.h" |
24 | 25 |
25 using content::BrowserThread; | 26 using content::BrowserThread; |
26 using content::RenderProcessHost; | 27 using content::RenderProcessHost; |
27 | 28 |
28 namespace extensions { | 29 namespace extensions { |
29 | 30 |
30 namespace { | 31 namespace { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveFilteredListener, | 128 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveFilteredListener, |
128 OnExtensionRemoveFilteredListener) | 129 OnExtensionRemoveFilteredListener) |
129 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ShouldSuspendAck, | 130 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ShouldSuspendAck, |
130 OnExtensionShouldSuspendAck) | 131 OnExtensionShouldSuspendAck) |
131 IPC_MESSAGE_HANDLER(ExtensionHostMsg_SuspendAck, | 132 IPC_MESSAGE_HANDLER(ExtensionHostMsg_SuspendAck, |
132 OnExtensionSuspendAck) | 133 OnExtensionSuspendAck) |
133 IPC_MESSAGE_HANDLER(ExtensionHostMsg_TransferBlobsAck, | 134 IPC_MESSAGE_HANDLER(ExtensionHostMsg_TransferBlobsAck, |
134 OnExtensionTransferBlobsAck) | 135 OnExtensionTransferBlobsAck) |
135 IPC_MESSAGE_HANDLER(ExtensionHostMsg_WakeEventPage, | 136 IPC_MESSAGE_HANDLER(ExtensionHostMsg_WakeEventPage, |
136 OnExtensionWakeEventPage) | 137 OnExtensionWakeEventPage) |
138 IPC_MESSAGE_HANDLER(ExtensionHostMsg_NotifyBadExtensionApiSchema, | |
139 OnExtensionNotifyBadExtensionApiSchema) | |
137 IPC_MESSAGE_UNHANDLED(handled = false) | 140 IPC_MESSAGE_UNHANDLED(handled = false) |
138 IPC_END_MESSAGE_MAP() | 141 IPC_END_MESSAGE_MAP() |
139 return handled; | 142 return handled; |
140 } | 143 } |
141 | 144 |
142 void ExtensionMessageFilter::OnExtensionAddListener( | 145 void ExtensionMessageFilter::OnExtensionAddListener( |
143 const std::string& extension_id, | 146 const std::string& extension_id, |
144 const GURL& listener_url, | 147 const GURL& listener_url, |
145 const std::string& event_name) { | 148 const std::string& event_name) { |
146 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 149 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 | 314 |
312 // The extension has no background page, so there is nothing to wake. | 315 // The extension has no background page, so there is nothing to wake. |
313 SendWakeEventPageResponse(request_id, false); | 316 SendWakeEventPageResponse(request_id, false); |
314 } | 317 } |
315 | 318 |
316 void ExtensionMessageFilter::SendWakeEventPageResponse(int request_id, | 319 void ExtensionMessageFilter::SendWakeEventPageResponse(int request_id, |
317 bool success) { | 320 bool success) { |
318 Send(new ExtensionMsg_WakeEventPageResponse(request_id, success)); | 321 Send(new ExtensionMsg_WakeEventPageResponse(request_id, success)); |
319 } | 322 } |
320 | 323 |
324 void ExtensionMessageFilter::OnExtensionNotifyBadExtensionApiSchema( | |
325 const std::string& api) { | |
326 ExtensionAPI::GetSharedInstance()->LoadSchemaListOrDie(api); | |
Devlin
2016/08/19 18:40:57
Thinking about it, is there a reason to not just d
Devlin
2016/08/19 19:13:27
(Another advantage to that is that then we don't n
Wez
2016/08/20 01:40:39
Done.
| |
327 } | |
328 | |
321 } // namespace extensions | 329 } // namespace extensions |
OLD | NEW |