OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ |
6 #define CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ | 6 #define CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 void updateGeometry(const blink::WebRect& window_rect, | 78 void updateGeometry(const blink::WebRect& window_rect, |
79 const blink::WebRect& clip_rect, | 79 const blink::WebRect& clip_rect, |
80 const blink::WebRect& unobscured_rect, | 80 const blink::WebRect& unobscured_rect, |
81 const blink::WebVector<blink::WebRect>& cut_outs_rects, | 81 const blink::WebVector<blink::WebRect>& cut_outs_rects, |
82 bool is_visible) override; | 82 bool is_visible) override; |
83 void updateFocus(bool focused, blink::WebFocusType focus_type) override; | 83 void updateFocus(bool focused, blink::WebFocusType focus_type) override; |
84 void updateVisibility(bool visible) override; | 84 void updateVisibility(bool visible) override; |
85 bool acceptsInputEvents() override; | 85 bool acceptsInputEvents() override; |
86 bool handleInputEvent(const blink::WebInputEvent& event, | 86 bool handleInputEvent(const blink::WebInputEvent& event, |
87 blink::WebCursorInfo& cursor_info) override; | 87 blink::WebCursorInfo& cursor_info) override; |
88 void didReceiveResponse(const blink::WebURLResponse& response) override; | 88 void didReceiveResponse(const blink::WebURLResponse& response) override {} |
89 void didReceiveData(const char* data, int data_length) override; | 89 void didReceiveData(const char* data, int data_length) override {} |
90 void didFinishLoading() override; | 90 void didFinishLoading() override {} |
91 void didFailLoading(const blink::WebURLError& error) override; | 91 void didFailLoading(const blink::WebURLError& error) override {} |
92 void didFinishLoadingFrameRequest(const blink::WebURL& url, | |
93 void* notify_data) override; | |
94 void didFailLoadingFrameRequest(const blink::WebURL& url, | |
95 void* notify_data, | |
96 const blink::WebURLError& error) override; | |
97 bool isPlaceholder() override; | 92 bool isPlaceholder() override; |
98 | 93 |
99 // WebPlugin implementation: | 94 // WebPlugin implementation: |
100 void SetWindow(gfx::PluginWindowHandle window) override; | 95 void SetWindow(gfx::PluginWindowHandle window) override; |
101 void SetAcceptsInputEvents(bool accepts) override; | 96 void SetAcceptsInputEvents(bool accepts) override; |
102 void WillDestroyWindow(gfx::PluginWindowHandle window) override; | 97 void WillDestroyWindow(gfx::PluginWindowHandle window) override; |
103 void CancelResource(unsigned long id) override; | 98 void CancelResource(unsigned long id) override; |
104 void Invalidate() override; | 99 void Invalidate() override; |
105 void InvalidateRect(const gfx::Rect& rect) override; | 100 void InvalidateRect(const gfx::Rect& rect) override; |
106 NPObject* GetWindowScriptNPObject() override; | 101 NPObject* GetWindowScriptNPObject() override; |
107 NPObject* GetPluginElement() override; | 102 NPObject* GetPluginElement() override; |
108 bool FindProxyForUrl(const GURL& url, std::string* proxy_list) override; | 103 bool FindProxyForUrl(const GURL& url, std::string* proxy_list) override; |
109 void SetCookie(const GURL& url, | 104 void SetCookie(const GURL& url, |
110 const GURL& first_party_for_cookies, | 105 const GURL& first_party_for_cookies, |
111 const std::string& cookie) override; | 106 const std::string& cookie) override; |
112 std::string GetCookies(const GURL& url, | 107 std::string GetCookies(const GURL& url, |
113 const GURL& first_party_for_cookies) override; | 108 const GURL& first_party_for_cookies) override; |
114 void HandleURLRequest(const char* url, | |
115 const char* method, | |
116 const char* target, | |
117 const char* buf, | |
118 unsigned int len, | |
119 int notify_id, | |
120 bool popups_allowed, | |
121 bool notify_redirects) override; | |
122 void CancelDocumentLoad() override; | 109 void CancelDocumentLoad() override; |
123 void InitiateHTTPRangeRequest(const char* url, | |
124 const char* range_info, | |
125 int pending_request_id) override; | |
126 void DidStartLoading() override; | 110 void DidStartLoading() override; |
127 void DidStopLoading() override; | 111 void DidStopLoading() override; |
128 bool IsOffTheRecord() override; | 112 bool IsOffTheRecord() override; |
129 void SetDeferResourceLoading(unsigned long resource_id, bool defer) override; | 113 void SetDeferResourceLoading(unsigned long resource_id, bool defer) override; |
130 void URLRedirectResponse(bool allow, int resource_id) override; | 114 void URLRedirectResponse(bool allow, int resource_id) override; |
131 bool CheckIfRunInsecureContent(const GURL& url) override; | 115 bool CheckIfRunInsecureContent(const GURL& url) override; |
132 #if defined(OS_WIN) | 116 #if defined(OS_WIN) |
133 void SetWindowlessData(HANDLE pump_messages_event, | 117 void SetWindowlessData(HANDLE pump_messages_event, |
134 gfx::NativeViewId dummy_activation_window) override {} | 118 gfx::NativeViewId dummy_activation_window) override {} |
135 void ReparentPluginWindow(HWND window, HWND parent) { } | 119 void ReparentPluginWindow(HWND window, HWND parent) { } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // Given a download request, check if we need to route the output to a frame. | 151 // Given a download request, check if we need to route the output to a frame. |
168 // Returns ROUTED if the load is done and routed to a frame, NOT_ROUTED or | 152 // Returns ROUTED if the load is done and routed to a frame, NOT_ROUTED or |
169 // corresponding error codes otherwise. | 153 // corresponding error codes otherwise. |
170 RoutingStatus RouteToFrame(const char* url, | 154 RoutingStatus RouteToFrame(const char* url, |
171 bool is_javascript_url, | 155 bool is_javascript_url, |
172 bool popups_allowed, | 156 bool popups_allowed, |
173 const char* method, | 157 const char* method, |
174 const char* target, | 158 const char* target, |
175 const char* buf, | 159 const char* buf, |
176 unsigned int len, | 160 unsigned int len, |
177 int notify_id, | |
178 ReferrerValue referrer_flag); | 161 ReferrerValue referrer_flag); |
179 | 162 |
180 // Returns the next avaiable resource id. Returns 0 if the operation fails. | 163 // Returns the next avaiable resource id. Returns 0 if the operation fails. |
181 // It may fail if the page has already been closed. | 164 // It may fail if the page has already been closed. |
182 unsigned long GetNextResourceId(); | 165 unsigned long GetNextResourceId(); |
183 | 166 |
184 // Initiates HTTP GET/POST requests. | |
185 // Returns true on success. | |
186 bool InitiateHTTPRequest(unsigned long resource_id, | |
187 WebPluginResourceClient* client, | |
188 const GURL& url, | |
189 const char* method, | |
190 const char* buf, | |
191 int len, | |
192 const char* range_info, | |
193 ReferrerValue referrer_flag, | |
194 bool notify_redirects, | |
195 bool check_mixed_scripting); | |
196 | |
197 gfx::Rect GetWindowClipRect(const gfx::Rect& rect); | 167 gfx::Rect GetWindowClipRect(const gfx::Rect& rect); |
198 | 168 |
199 // Sets the actual Widget for the plugin. | 169 // Sets the actual Widget for the plugin. |
200 void SetContainer(blink::WebPluginContainer* container); | 170 void SetContainer(blink::WebPluginContainer* container); |
201 | 171 |
202 // Destroys the plugin instance. | 172 // Destroys the plugin instance. |
203 // The response_handle_to_ignore parameter if not NULL indicates the | 173 // The response_handle_to_ignore parameter if not NULL indicates the |
204 // resource handle to be left valid during plugin shutdown. | 174 // resource handle to be left valid during plugin shutdown. |
205 void TearDownPluginInstance(blink::WebURLLoader* loader_to_ignore); | 175 void TearDownPluginInstance(blink::WebURLLoader* loader_to_ignore); |
206 | 176 |
(...skipping 24 matching lines...) Expand all Loading... |
231 // request given a handle. | 201 // request given a handle. |
232 void RemoveClient(blink::WebURLLoader* loader); | 202 void RemoveClient(blink::WebURLLoader* loader); |
233 | 203 |
234 // Handles HTTP multipart responses, i.e. responses received with a HTTP | 204 // Handles HTTP multipart responses, i.e. responses received with a HTTP |
235 // status code of 206. | 205 // status code of 206. |
236 // Returns false if response is not multipart (may be if we requested | 206 // Returns false if response is not multipart (may be if we requested |
237 // single range). | 207 // single range). |
238 bool HandleHttpMultipartResponse(const blink::WebURLResponse& response, | 208 bool HandleHttpMultipartResponse(const blink::WebURLResponse& response, |
239 WebPluginResourceClient* client); | 209 WebPluginResourceClient* client); |
240 | 210 |
241 void HandleURLRequestInternal(const char* url, | |
242 const char* method, | |
243 const char* target, | |
244 const char* buf, | |
245 unsigned int len, | |
246 int notify_id, | |
247 bool popups_allowed, | |
248 ReferrerValue referrer_flag, | |
249 bool notify_redirects, | |
250 bool check_mixed_scripting); | |
251 | |
252 // Tears down the existing plugin instance and creates a new plugin instance | 211 // Tears down the existing plugin instance and creates a new plugin instance |
253 // to handle the response identified by the loader parameter. | 212 // to handle the response identified by the loader parameter. |
254 bool ReinitializePluginForResponse(blink::WebURLLoader* loader); | 213 bool ReinitializePluginForResponse(blink::WebURLLoader* loader); |
255 | 214 |
256 // Delayed task for downloading the plugin source URL. | |
257 void OnDownloadPluginSrcUrl(); | |
258 | |
259 struct ClientInfo; | 215 struct ClientInfo; |
260 | 216 |
261 // Helper functions | 217 // Helper functions |
262 WebPluginResourceClient* GetClientFromLoader(blink::WebURLLoader* loader); | 218 WebPluginResourceClient* GetClientFromLoader(blink::WebURLLoader* loader); |
263 ClientInfo* GetClientInfoFromLoader(blink::WebURLLoader* loader); | 219 ClientInfo* GetClientInfoFromLoader(blink::WebURLLoader* loader); |
264 | 220 |
265 // Helper function to set the referrer on the request passed in. | 221 // Helper function to set the referrer on the request passed in. |
266 void SetReferrer(blink::WebURLRequest* request, ReferrerValue referrer_flag); | 222 void SetReferrer(blink::WebURLRequest* request, ReferrerValue referrer_flag); |
267 | 223 |
268 // Check for invalid chars like @, ;, \ before the first / (in path). | 224 // Check for invalid chars like @, ;, \ before the first / (in path). |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 LoaderClient loader_client_; | 315 LoaderClient loader_client_; |
360 | 316 |
361 base::WeakPtrFactory<WebPluginImpl> weak_factory_; | 317 base::WeakPtrFactory<WebPluginImpl> weak_factory_; |
362 | 318 |
363 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); | 319 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); |
364 }; | 320 }; |
365 | 321 |
366 } // namespace content | 322 } // namespace content |
367 | 323 |
368 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ | 324 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ |
OLD | NEW |