OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H__ | 5 #ifndef CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H__ |
6 #define CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H__ | 6 #define CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H__ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 WebPlugin* plugin, bool load_manually); | 53 WebPlugin* plugin, bool load_manually); |
54 virtual void UpdateGeometry(const gfx::Rect& window_rect, | 54 virtual void UpdateGeometry(const gfx::Rect& window_rect, |
55 const gfx::Rect& clip_rect, bool visible); | 55 const gfx::Rect& clip_rect, bool visible); |
56 virtual void Paint(HDC hdc, const gfx::Rect& rect); | 56 virtual void Paint(HDC hdc, const gfx::Rect& rect); |
57 virtual void Print(HDC hdc); | 57 virtual void Print(HDC hdc); |
58 virtual NPObject* GetPluginScriptableObject(); | 58 virtual NPObject* GetPluginScriptableObject(); |
59 virtual void DidFinishLoadWithReason(NPReason reason); | 59 virtual void DidFinishLoadWithReason(NPReason reason); |
60 virtual void SetFocus(); | 60 virtual void SetFocus(); |
61 virtual bool HandleEvent(NPEvent* event, WebCursor* cursor); | 61 virtual bool HandleEvent(NPEvent* event, WebCursor* cursor); |
62 virtual int GetProcessId(); | 62 virtual int GetProcessId(); |
63 virtual HWND GetWindowHandle(); | |
64 | 63 |
65 // IPC::Channel::Listener implementation: | 64 // IPC::Channel::Listener implementation: |
66 virtual void OnMessageReceived(const IPC::Message& msg); | 65 virtual void OnMessageReceived(const IPC::Message& msg); |
67 void OnChannelError(); | 66 void OnChannelError(); |
68 | 67 |
69 // IPC::Message::Sender implementation: | 68 // IPC::Message::Sender implementation: |
70 virtual bool Send(IPC::Message* msg); | 69 virtual bool Send(IPC::Message* msg); |
71 | 70 |
72 virtual void SendJavaScriptStream(const std::string& url, | 71 virtual void SendJavaScriptStream(const std::string& url, |
73 const std::wstring& result, | 72 const std::wstring& result, |
(...skipping 29 matching lines...) Expand all Loading... |
103 const std::string& clsid, | 102 const std::string& clsid, |
104 RenderView* render_view); | 103 RenderView* render_view); |
105 | 104 |
106 // Message handlers for messages that proxy WebPlugin methods, which | 105 // Message handlers for messages that proxy WebPlugin methods, which |
107 // we translate into calls to the real WebPlugin. | 106 // we translate into calls to the real WebPlugin. |
108 void OnSetWindow(HWND window, HANDLE modal_loop_pump_messages_event); | 107 void OnSetWindow(HWND window, HANDLE modal_loop_pump_messages_event); |
109 void OnCompleteURL(const std::string& url_in, std::string* url_out, | 108 void OnCompleteURL(const std::string& url_in, std::string* url_out, |
110 bool* result); | 109 bool* result); |
111 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); | 110 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); |
112 void OnCancelResource(int id); | 111 void OnCancelResource(int id); |
113 void OnInvalidate(); | |
114 void OnInvalidateRect(const gfx::Rect& rect); | 112 void OnInvalidateRect(const gfx::Rect& rect); |
115 void OnGetWindowScriptNPObject(int route_id, bool* success, void** npobject_pt
r); | 113 void OnGetWindowScriptNPObject(int route_id, bool* success, void** npobject_pt
r); |
116 void OnGetPluginElement(int route_id, bool* success, void** npobject_ptr); | 114 void OnGetPluginElement(int route_id, bool* success, void** npobject_ptr); |
117 void OnSetCookie(const GURL& url, | 115 void OnSetCookie(const GURL& url, |
118 const GURL& policy_url, | 116 const GURL& policy_url, |
119 const std::string& cookie); | 117 const std::string& cookie); |
120 void OnGetCookies(const GURL& url, const GURL& policy_url, | 118 void OnGetCookies(const GURL& url, const GURL& policy_url, |
121 std::string* cookies); | 119 std::string* cookies); |
122 void OnShowModalHTMLDialog(const GURL& url, int width, int height, | 120 void OnShowModalHTMLDialog(const GURL& url, int width, int height, |
123 const std::string& json_arguments, | 121 const std::string& json_arguments, |
124 std::string* json_retval); | 122 std::string* json_retval); |
125 void OnMissingPluginStatus(int status); | 123 void OnMissingPluginStatus(int status); |
126 void OnGetCPBrowsingContext(uint32* context); | 124 void OnGetCPBrowsingContext(uint32* context); |
127 void OnCancelDocumentLoad(); | 125 void OnCancelDocumentLoad(); |
128 void OnInitiateHTTPRangeRequest(const std::string& url, | 126 void OnInitiateHTTPRangeRequest(const std::string& url, |
129 const std::string& range_info, | 127 const std::string& range_info, |
130 HANDLE existing_stream, bool notify_needed, | 128 HANDLE existing_stream, bool notify_needed, |
131 HANDLE notify_data); | 129 HANDLE notify_data); |
132 | 130 |
133 // Draw a graphic indicating a crashed plugin. | 131 // Draw a graphic indicating a crashed plugin. |
134 void PaintSadPlugin(HDC hdc, const gfx::Rect& rect); | 132 void PaintSadPlugin(HDC hdc, const gfx::Rect& rect); |
135 | 133 |
| 134 // Returns true if the given rectangle is different in the hdc and the |
| 135 // current background bitmap. |
| 136 bool BackgroundChanged(HDC hdc, const gfx::Rect& rect); |
| 137 |
| 138 // Copies the given rectangle from the transport bitmap to the backing store. |
| 139 void CopyFromTransportToBacking(const gfx::Rect& rect); |
| 140 |
| 141 // Clears the shared memory section and canvases used for windowless plugins. |
| 142 void ResetWindowlessBitmaps(); |
| 143 |
| 144 // Creates a shared memory section and canvas. |
| 145 bool CreateBitmap(scoped_ptr<SharedMemory>* memory, |
| 146 scoped_ptr<gfx::PlatformCanvasWin>* canvas); |
| 147 |
136 RenderView* render_view_; | 148 RenderView* render_view_; |
137 WebPlugin* plugin_; | 149 WebPlugin* plugin_; |
138 bool windowless_; | 150 bool windowless_; |
139 bool first_paint_; | 151 bool first_paint_; |
140 scoped_refptr<PluginChannelHost> channel_host_; | 152 scoped_refptr<PluginChannelHost> channel_host_; |
141 std::string mime_type_; | 153 std::string mime_type_; |
142 std::string clsid_; | 154 std::string clsid_; |
143 int instance_id_; | 155 int instance_id_; |
144 std::wstring plugin_path_; | 156 std::wstring plugin_path_; |
145 | 157 |
146 gfx::Rect plugin_rect_; | 158 gfx::Rect plugin_rect_; |
147 gfx::Rect deferred_clip_rect_; | 159 gfx::Rect deferred_clip_rect_; |
148 bool send_deferred_update_geometry_; | 160 bool send_deferred_update_geometry_; |
149 bool visible_; | 161 bool visible_; |
150 | 162 |
151 NPObject* npobject_; | 163 NPObject* npobject_; |
152 NPObjectStub* window_script_object_; | 164 NPObjectStub* window_script_object_; |
153 | 165 |
154 // Event passed in by the plugin process and is used to decide if | 166 // Event passed in by the plugin process and is used to decide if |
155 // messages need to be pumped in the NPP_HandleEvent sync call. | 167 // messages need to be pumped in the NPP_HandleEvent sync call. |
156 ScopedHandle modal_loop_pump_messages_event_; | 168 ScopedHandle modal_loop_pump_messages_event_; |
157 | 169 |
158 // Bitmap for crashed plugin | 170 // Bitmap for crashed plugin |
159 SkBitmap* sad_plugin_; | 171 SkBitmap* sad_plugin_; |
160 | 172 |
161 // Used for desynchronized windowless painting. See the comment in | 173 // True if we got an invalidate from the plugin and are waiting for a paint. |
162 // webplugin_proxy.h for information about how this works. | 174 bool invalidate_pending_; |
163 scoped_ptr<SharedMemory> windowless_buffer_; | 175 |
164 scoped_ptr<gfx::PlatformCanvasWin> windowless_canvas_; | 176 // Used to desynchronize windowless painting. When WebKit paints, we bitblt |
165 ScopedHandle windowless_buffer_lock_; | 177 // from our backing store of what the plugin rectangle looks like. The |
| 178 // plugin paints into the transport store, and we copy that to our backing |
| 179 // store when we get an invalidate from it. The background bitmap is used |
| 180 // for transparent plugins, as they need the backgroud data during painting. |
| 181 bool transparent_; |
| 182 scoped_ptr<SharedMemory> backing_store_; |
| 183 scoped_ptr<gfx::PlatformCanvasWin> backing_store_canvas_; |
| 184 scoped_ptr<SharedMemory> transport_store_; |
| 185 scoped_ptr<gfx::PlatformCanvasWin> transport_store_canvas_; |
| 186 scoped_ptr<SharedMemory> background_store_; |
| 187 scoped_ptr<gfx::PlatformCanvasWin> background_store_canvas_; |
166 | 188 |
167 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateProxy); | 189 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateProxy); |
168 }; | 190 }; |
169 | 191 |
170 #endif // #ifndef CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H__ | 192 #endif // #ifndef CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H__ |
171 | 193 |
OLD | NEW |