Update broken references to image assets
[chromium-blink-merge.git] / content / plugin / webplugin_delegate_stub.h
blob63964e11555c31eaf604b499528c0b2c6af52e9a
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/child/npapi/npobject_stub.h"
13 #include "ipc/ipc_listener.h"
14 #include "ipc/ipc_sender.h"
15 #include "third_party/npapi/bindings/npapi.h"
16 #include "ui/gfx/geometry/rect.h"
17 #include "ui/gfx/native_widget_types.h"
18 #include "url/gurl.h"
20 struct PluginMsg_Init_Params;
21 struct PluginMsg_DidReceiveResponseParams;
22 struct PluginMsg_FetchURL_Params;
23 struct PluginMsg_UpdateGeometry_Param;
25 namespace blink {
26 class WebInputEvent;
29 namespace content {
30 class PluginChannel;
31 class WebCursor;
32 class WebPluginDelegateImpl;
33 class WebPluginProxy;
35 // Converts the IPC messages from WebPluginDelegateProxy into calls to the
36 // actual WebPluginDelegateImpl object.
37 class WebPluginDelegateStub : public IPC::Listener,
38 public IPC::Sender,
39 public base::RefCounted<WebPluginDelegateStub> {
40 public:
41 WebPluginDelegateStub(const std::string& mime_type, int instance_id,
42 PluginChannel* channel);
44 // IPC::Listener implementation:
45 bool OnMessageReceived(const IPC::Message& msg) override;
47 // IPC::Sender implementation:
48 bool Send(IPC::Message* msg) override;
50 int instance_id() { return instance_id_; }
51 WebPluginDelegateImpl* delegate() { return delegate_; }
52 WebPluginProxy* webplugin() { return webplugin_; }
54 private:
55 friend class base::RefCounted<WebPluginDelegateStub>;
57 ~WebPluginDelegateStub() override;
59 // Message handlers for the WebPluginDelegate calls that are proxied from the
60 // renderer over the IPC channel.
61 void OnInit(const PluginMsg_Init_Params& params,
62 bool* transparent,
63 bool* result);
64 void OnWillSendRequest(int id, const GURL& url, int http_status_code);
65 void OnDidReceiveResponse(const PluginMsg_DidReceiveResponseParams& params);
66 void OnDidReceiveData(int id, const std::vector<char>& buffer,
67 int data_offset);
68 void OnDidFinishLoading(int id);
69 void OnDidFail(int id);
70 void OnDidFinishLoadWithReason(const GURL& url, int reason, int notify_id);
71 void OnSetFocus(bool focused);
72 void OnHandleInputEvent(const blink::WebInputEvent* event,
73 bool* handled, WebCursor* cursor);
74 void OnPaint(const gfx::Rect& damaged_rect);
75 void OnDidPaint();
76 void OnUpdateGeometry(const PluginMsg_UpdateGeometry_Param& param);
77 void OnGetPluginScriptableObject(int* route_id);
78 void OnSendJavaScriptStream(const GURL& url,
79 const std::string& result,
80 bool success,
81 int notify_id);
82 void OnGetFormValue(base::string16* value, bool* success);
84 void OnSetContentAreaFocus(bool has_focus);
85 #if defined(OS_WIN) && !defined(USE_AURA)
86 void OnImeCompositionUpdated(const base::string16& text,
87 const std::vector<int>& clauses,
88 const std::vector<int>& target,
89 int cursor_position);
90 void OnImeCompositionCompleted(const base::string16& text);
91 #endif
92 #if defined(OS_MACOSX)
93 void OnSetWindowFocus(bool has_focus);
94 void OnContainerHidden();
95 void OnContainerShown(gfx::Rect window_frame, gfx::Rect view_frame,
96 bool has_focus);
97 void OnWindowFrameChanged(const gfx::Rect& window_frame,
98 const gfx::Rect& view_frame);
99 void OnImeCompositionCompleted(const base::string16& text);
100 #endif
102 void OnDidReceiveManualResponse(
103 const GURL& url,
104 const PluginMsg_DidReceiveResponseParams& params);
105 void OnDidReceiveManualData(const std::vector<char>& buffer);
106 void OnDidFinishManualLoading();
107 void OnDidManualLoadFail();
108 void OnHandleURLRequestReply(unsigned long resource_id,
109 const GURL& url,
110 int notify_id);
111 void OnHTTPRangeRequestReply(unsigned long resource_id, int range_request_id);
112 void OnFetchURL(const PluginMsg_FetchURL_Params& params);
114 std::string mime_type_;
115 int instance_id_;
117 scoped_refptr<PluginChannel> channel_;
119 base::WeakPtr<NPObjectStub> plugin_scriptable_object_;
120 WebPluginDelegateImpl* delegate_;
121 WebPluginProxy* webplugin_;
122 bool in_destructor_;
124 // The url of the main frame hosting the plugin.
125 GURL page_url_;
127 DISALLOW_IMPLICIT_CONSTRUCTORS(WebPluginDelegateStub);
130 } // namespace content
132 #endif // CONTENT_PLUGIN_WEBPLUGIN_DELEGATE_STUB_H_