| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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 #ifndef CONTENT_PLUGIN_WEBPLUGIN_DELEGATE_STUB_H_ | |
| 6 #define CONTENT_PLUGIN_WEBPLUGIN_DELEGATE_STUB_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "build/build_config.h" | |
| 14 #include "ipc/ipc_listener.h" | |
| 15 #include "ipc/ipc_sender.h" | |
| 16 #include "third_party/npapi/bindings/npapi.h" | |
| 17 #include "ui/gfx/geometry/rect.h" | |
| 18 #include "ui/gfx/native_widget_types.h" | |
| 19 #include "url/gurl.h" | |
| 20 | |
| 21 struct PluginMsg_Init_Params; | |
| 22 struct PluginMsg_UpdateGeometry_Param; | |
| 23 | |
| 24 namespace blink { | |
| 25 class WebInputEvent; | |
| 26 } | |
| 27 | |
| 28 namespace content { | |
| 29 class PluginChannel; | |
| 30 class WebCursor; | |
| 31 class WebPluginDelegateImpl; | |
| 32 class WebPluginProxy; | |
| 33 | |
| 34 // Converts the IPC messages from WebPluginDelegateProxy into calls to the | |
| 35 // actual WebPluginDelegateImpl object. | |
| 36 class WebPluginDelegateStub : public IPC::Listener, | |
| 37 public IPC::Sender, | |
| 38 public base::RefCounted<WebPluginDelegateStub> { | |
| 39 public: | |
| 40 WebPluginDelegateStub(const std::string& mime_type, int instance_id, | |
| 41 PluginChannel* channel); | |
| 42 | |
| 43 // IPC::Listener implementation: | |
| 44 bool OnMessageReceived(const IPC::Message& msg) override; | |
| 45 | |
| 46 // IPC::Sender implementation: | |
| 47 bool Send(IPC::Message* msg) override; | |
| 48 | |
| 49 int instance_id() { return instance_id_; } | |
| 50 WebPluginDelegateImpl* delegate() { return delegate_; } | |
| 51 WebPluginProxy* webplugin() { return webplugin_; } | |
| 52 | |
| 53 private: | |
| 54 friend class base::RefCounted<WebPluginDelegateStub>; | |
| 55 | |
| 56 ~WebPluginDelegateStub() override; | |
| 57 | |
| 58 // Message handlers for the WebPluginDelegate calls that are proxied from the | |
| 59 // renderer over the IPC channel. | |
| 60 void OnInit(const PluginMsg_Init_Params& params, | |
| 61 bool* transparent, | |
| 62 bool* result); | |
| 63 void OnSetFocus(bool focused); | |
| 64 void OnHandleInputEvent(const blink::WebInputEvent* event, | |
| 65 bool* handled, WebCursor* cursor); | |
| 66 void OnPaint(const gfx::Rect& damaged_rect); | |
| 67 void OnDidPaint(); | |
| 68 void OnUpdateGeometry(const PluginMsg_UpdateGeometry_Param& param); | |
| 69 | |
| 70 void OnSetContentAreaFocus(bool has_focus); | |
| 71 #if defined(OS_MACOSX) | |
| 72 void OnSetWindowFocus(bool has_focus); | |
| 73 void OnContainerHidden(); | |
| 74 void OnContainerShown(gfx::Rect window_frame, gfx::Rect view_frame, | |
| 75 bool has_focus); | |
| 76 void OnWindowFrameChanged(const gfx::Rect& window_frame, | |
| 77 const gfx::Rect& view_frame); | |
| 78 void OnImeCompositionCompleted(const base::string16& text); | |
| 79 #endif | |
| 80 | |
| 81 std::string mime_type_; | |
| 82 int instance_id_; | |
| 83 | |
| 84 scoped_refptr<PluginChannel> channel_; | |
| 85 | |
| 86 WebPluginDelegateImpl* delegate_; | |
| 87 WebPluginProxy* webplugin_; | |
| 88 bool in_destructor_; | |
| 89 | |
| 90 // The url of the main frame hosting the plugin. | |
| 91 GURL page_url_; | |
| 92 | |
| 93 DISALLOW_IMPLICIT_CONSTRUCTORS(WebPluginDelegateStub); | |
| 94 }; | |
| 95 | |
| 96 } // namespace content | |
| 97 | |
| 98 #endif // CONTENT_PLUGIN_WEBPLUGIN_DELEGATE_STUB_H_ | |
| OLD | NEW |