Fix build break
[chromium-blink-merge.git] / content / plugin / webplugin_delegate_stub.h
blob7be9261716fd9e7e827367cd54ef4a4b575d61cd
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.
5 #ifndef CONTENT_PLUGIN_WEBPLUGIN_DELEGATE_STUB_H_
6 #define CONTENT_PLUGIN_WEBPLUGIN_DELEGATE_STUB_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/ref_counted.h"
12 #include "content/common/npobject_stub.h"
13 #include "googleurl/src/gurl.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/native_widget_types.h"
18 #include "ui/gfx/rect.h"
20 struct PluginMsg_Init_Params;
21 struct PluginMsg_DidReceiveResponseParams;
22 struct PluginMsg_UpdateGeometry_Param;
23 class WebCursor;
25 namespace WebKit {
26 class WebInputEvent;
29 namespace webkit {
30 namespace npapi {
31 class WebPluginDelegateImpl;
35 namespace content {
36 class PluginChannel;
37 class WebPluginProxy;
39 // Converts the IPC messages from WebPluginDelegateProxy into calls to the
40 // actual WebPluginDelegateImpl object.
41 class WebPluginDelegateStub : public IPC::Listener,
42 public IPC::Sender,
43 public base::RefCounted<WebPluginDelegateStub> {
44 public:
45 WebPluginDelegateStub(const std::string& mime_type, int instance_id,
46 PluginChannel* channel);
48 // IPC::Listener implementation:
49 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
51 // IPC::Sender implementation:
52 virtual bool Send(IPC::Message* msg) OVERRIDE;
54 int instance_id() { return instance_id_; }
55 WebPluginProxy* webplugin() { return webplugin_; }
57 private:
58 friend class base::RefCounted<WebPluginDelegateStub>;
60 virtual ~WebPluginDelegateStub();
62 // Message handlers for the WebPluginDelegate calls that are proxied from the
63 // renderer over the IPC channel.
64 void OnInit(const PluginMsg_Init_Params& params,
65 bool* transparent,
66 bool* result);
67 void OnWillSendRequest(int id, const GURL& url, int http_status_code);
68 void OnDidReceiveResponse(const PluginMsg_DidReceiveResponseParams& params);
69 void OnDidReceiveData(int id, const std::vector<char>& buffer,
70 int data_offset);
71 void OnDidFinishLoading(int id);
72 void OnDidFail(int id);
73 void OnDidFinishLoadWithReason(const GURL& url, int reason, int notify_id);
74 void OnSetFocus(bool focused);
75 void OnHandleInputEvent(const WebKit::WebInputEvent* event,
76 bool* handled, WebCursor* cursor);
77 void OnPaint(const gfx::Rect& damaged_rect);
78 void OnDidPaint();
79 void OnUpdateGeometry(const PluginMsg_UpdateGeometry_Param& param);
80 void OnGetPluginScriptableObject(int* route_id);
81 void OnSendJavaScriptStream(const GURL& url,
82 const std::string& result,
83 bool success,
84 int notify_id);
85 void OnGetFormValue(string16* value, bool* success);
87 void OnSetContentAreaFocus(bool has_focus);
88 #if defined(OS_WIN) && !defined(USE_AURA)
89 void OnImeCompositionUpdated(const string16& text,
90 const std::vector<int>& clauses,
91 const std::vector<int>& target,
92 int cursor_position);
93 void OnImeCompositionCompleted(const string16& text);
94 #endif
95 #if defined(OS_MACOSX)
96 void OnSetWindowFocus(bool has_focus);
97 void OnContainerHidden();
98 void OnContainerShown(gfx::Rect window_frame, gfx::Rect view_frame,
99 bool has_focus);
100 void OnWindowFrameChanged(const gfx::Rect& window_frame,
101 const gfx::Rect& view_frame);
102 void OnImeCompositionCompleted(const string16& text);
103 #endif
105 void OnDidReceiveManualResponse(
106 const GURL& url,
107 const PluginMsg_DidReceiveResponseParams& params);
108 void OnDidReceiveManualData(const std::vector<char>& buffer);
109 void OnDidFinishManualLoading();
110 void OnDidManualLoadFail();
111 void OnHandleURLRequestReply(unsigned long resource_id,
112 const GURL& url,
113 int notify_id);
114 void OnHTTPRangeRequestReply(unsigned long resource_id, int range_request_id);
116 std::string mime_type_;
117 int instance_id_;
119 scoped_refptr<PluginChannel> channel_;
121 base::WeakPtr<NPObjectStub> plugin_scriptable_object_;
122 webkit::npapi::WebPluginDelegateImpl* delegate_;
123 WebPluginProxy* webplugin_;
124 bool in_destructor_;
126 // The url of the main frame hosting the plugin.
127 GURL page_url_;
129 DISALLOW_IMPLICIT_CONSTRUCTORS(WebPluginDelegateStub);
132 } // namespace content
134 #endif // CONTENT_PLUGIN_WEBPLUGIN_DELEGATE_STUB_H_