Index: chrome/renderer/extensions/platform_app_dispatcher.cc |
diff --git a/chrome/renderer/extensions/platform_app_dispatcher.cc b/chrome/renderer/extensions/platform_app_dispatcher.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7253d859e0d7e9de3e8efe2015a9e4a18a58dac5 |
--- /dev/null |
+++ b/chrome/renderer/extensions/platform_app_dispatcher.cc |
@@ -0,0 +1,44 @@ |
+// Copyright (c) 2011 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 "chrome/renderer/extensions/platform_app_dispatcher.h" |
+ |
+#include "base/logging.h" |
+#include "grit/renderer_resources.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
+#include "ui/base/resource/resource_bundle.h" |
+#include "chrome/common/extensions/platform_app_messages.h" |
+ |
+using WebKit::WebString; |
+using WebKit::WebView; |
+using WebKit::WebVector; |
+ |
+PlatformAppDispatcher::PlatformAppDispatcher() { |
+} |
+ |
+PlatformAppDispatcher::~PlatformAppDispatcher() { |
+} |
+ |
+bool PlatformAppDispatcher::OnControlMessageReceived( |
+ const IPC::Message& message) { |
+ bool handled = true; |
+ IPC_BEGIN_MESSAGE_MAP(PlatformAppDispatcher, message) |
+ IPC_MESSAGE_HANDLER(PlatformAppMsg_IsPlatformApp, OnIsPlatformApp) |
+ IPC_MESSAGE_UNHANDLED(handled = false) |
+ IPC_END_MESSAGE_MAP() |
+ |
+ return handled; |
+} |
+ |
+void PlatformAppDispatcher::OnIsPlatformApp() { |
+ WebString scheme(WebString::fromUTF8("chrome-extension://*/*")); |
+ WebVector<WebString> patterns; |
+ patterns.assign(&scheme, 1); |
+ WebView::addUserStyleSheet( |
+ WebString::fromUTF8(ResourceBundle::GetSharedInstance(). |
+ GetRawDataResource(IDR_PLATFORM_APP_CSS)), |
+ patterns, |
+ WebView::UserContentInjectInAllFrames, |
+ WebView::UserStyleInjectInExistingDocuments); |
+} |