Index: content/browser/renderer_host/extension_system_message_filter.cc |
diff --git a/content/browser/renderer_host/extension_system_message_filter.cc b/content/browser/renderer_host/extension_system_message_filter.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..743a4b4470840491d71b08cf88d1922c0007eef1 |
--- /dev/null |
+++ b/content/browser/renderer_host/extension_system_message_filter.cc |
@@ -0,0 +1,67 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/browser/renderer_host/extension_system_message_filter.h" |
+ |
+#include "content/public/browser/browser_message_filter.h" |
+#include "content/public/browser/extension_system_notifications.h" |
+#include "content/public/browser/notification_service.h" |
+#include "content/public/browser/notification_source.h" |
+#include "content/public/browser/notification_types.h" |
+#include "content/public/browser/render_process_host.h" |
+#include "content/public/common/extension_system_messages.h" |
+#include "googleurl/src/gurl.h" |
+#include "ipc/ipc_message_macros.h" |
+#include "content/public/browser/browser_thread.h" |
+ |
+namespace content { |
+ |
+ExtensionSystemMessageFilter::ExtensionSystemMessageFilter( |
+ RenderProcessHost* render_process_host) |
+ : render_process_host_(render_process_host) { |
+} |
+ |
+bool ExtensionSystemMessageFilter::OnMessageReceived( |
+ const IPC::Message& message, |
+ bool* message_was_ok) { |
+ bool handled = true; |
+ IPC_BEGIN_MESSAGE_MAP_EX(ExtensionSystemMessageFilter, |
+ message, *message_was_ok) |
+ IPC_MESSAGE_HANDLER(ExtensionSystemMsg_LaunchAppWithUrl, |
Charlie Reis
2013/08/26 22:17:52
Same with apps. Is there a way to move this to ch
sergeygs
2013/08/29 08:24:42
Changed the naming to reflect the actual nature of
|
+ OnLaunchAppWithUrl) |
+ IPC_MESSAGE_UNHANDLED(handled = false) |
+ IPC_END_MESSAGE_MAP_EX() |
+ |
+ return handled; |
+} |
+ |
+ExtensionSystemMessageFilter::~ExtensionSystemMessageFilter() { |
+} |
+ |
+bool ExtensionSystemMessageFilter::OnLaunchAppWithUrl( |
+ const std::string& app_id, |
+ const std::string& handler_id, |
+ const GURL& url, |
+ const GURL& referrer_url) { |
+ LaunchAppWithUrlDetails details(app_id, handler_id, url, referrer_url); |
+ NotificationService::current()->Notify( |
+ content::NOTIFICATION_LAUNCH_APP_WITH_URL, |
+ Source<RenderProcessHost>(render_process_host_), |
+ Details<LaunchAppWithUrlDetails>(&details)); |
+ |
+ return true; |
+} |
+ |
+void ExtensionSystemMessageFilter::OverrideThreadForMessage( |
+ const IPC::Message& message, BrowserThread::ID* thread) { |
+ switch (message.type()) { |
+ case ExtensionSystemMsg_LaunchAppWithUrl::ID: |
+ *thread = BrowserThread::UI; |
+ break; |
+ default: |
+ break; |
+ } |
+} |
+ |
+} |