OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/renderer/extensions/platform_app_dispatcher.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "grit/renderer_resources.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 10 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "chrome/common/extensions/platform_app_messages.h" |
| 12 |
| 13 using WebKit::WebString; |
| 14 using WebKit::WebView; |
| 15 using WebKit::WebVector; |
| 16 |
| 17 PlatformAppDispatcher::PlatformAppDispatcher() { |
| 18 } |
| 19 |
| 20 PlatformAppDispatcher::~PlatformAppDispatcher() { |
| 21 } |
| 22 |
| 23 bool PlatformAppDispatcher::OnControlMessageReceived( |
| 24 const IPC::Message& message) { |
| 25 bool handled = true; |
| 26 IPC_BEGIN_MESSAGE_MAP(PlatformAppDispatcher, message) |
| 27 IPC_MESSAGE_HANDLER(PlatformAppMsg_IsPlatformApp, OnIsPlatformApp) |
| 28 IPC_MESSAGE_UNHANDLED(handled = false) |
| 29 IPC_END_MESSAGE_MAP() |
| 30 |
| 31 return handled; |
| 32 } |
| 33 |
| 34 void PlatformAppDispatcher::OnIsPlatformApp() { |
| 35 WebString scheme(WebString::fromUTF8("chrome-extension://*/*")); |
| 36 WebVector<WebString> patterns; |
| 37 patterns.assign(&scheme, 1); |
| 38 WebView::addUserStyleSheet( |
| 39 WebString::fromUTF8(ResourceBundle::GetSharedInstance(). |
| 40 GetRawDataResource(IDR_PLATFORM_APP_CSS)), |
| 41 patterns, |
| 42 WebView::UserContentInjectInAllFrames, |
| 43 WebView::UserStyleInjectInExistingDocuments); |
| 44 } |
OLD | NEW |