Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(766)

Side by Side Diff: content/renderer/npapi/webplugin_impl.h

Issue 736743003: Use content::Referrer to pass around referrers in the plugin code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 enum RoutingStatus { 149 enum RoutingStatus {
150 ROUTED, 150 ROUTED,
151 NOT_ROUTED, 151 NOT_ROUTED,
152 INVALID_URL, 152 INVALID_URL,
153 GENERAL_FAILURE 153 GENERAL_FAILURE
154 }; 154 };
155 155
156 // Determines the referrer value sent along with outgoing HTTP requests 156 // Determines the referrer value sent along with outgoing HTTP requests
157 // issued by plugins. 157 // issued by plugins.
158 enum Referrer { 158 enum ReferrerValue {
159 PLUGIN_SRC, 159 PLUGIN_SRC,
160 DOCUMENT_URL, 160 DOCUMENT_URL,
161 NO_REFERRER 161 NO_REFERRER
162 }; 162 };
163 163
164 // Given a download request, check if we need to route the output to a frame. 164 // Given a download request, check if we need to route the output to a frame.
165 // Returns ROUTED if the load is done and routed to a frame, NOT_ROUTED or 165 // Returns ROUTED if the load is done and routed to a frame, NOT_ROUTED or
166 // corresponding error codes otherwise. 166 // corresponding error codes otherwise.
167 RoutingStatus RouteToFrame(const char* url, 167 RoutingStatus RouteToFrame(const char* url,
168 bool is_javascript_url, 168 bool is_javascript_url,
169 bool popups_allowed, 169 bool popups_allowed,
170 const char* method, 170 const char* method,
171 const char* target, 171 const char* target,
172 const char* buf, 172 const char* buf,
173 unsigned int len, 173 unsigned int len,
174 int notify_id, 174 int notify_id,
175 Referrer referrer_flag); 175 ReferrerValue referrer_flag);
176 176
177 // Returns the next avaiable resource id. Returns 0 if the operation fails. 177 // Returns the next avaiable resource id. Returns 0 if the operation fails.
178 // It may fail if the page has already been closed. 178 // It may fail if the page has already been closed.
179 unsigned long GetNextResourceId(); 179 unsigned long GetNextResourceId();
180 180
181 // Initiates HTTP GET/POST requests. 181 // Initiates HTTP GET/POST requests.
182 // Returns true on success. 182 // Returns true on success.
183 bool InitiateHTTPRequest(unsigned long resource_id, 183 bool InitiateHTTPRequest(unsigned long resource_id,
184 WebPluginResourceClient* client, 184 WebPluginResourceClient* client,
185 const GURL& url, 185 const GURL& url,
186 const char* method, 186 const char* method,
187 const char* buf, 187 const char* buf,
188 int len, 188 int len,
189 const char* range_info, 189 const char* range_info,
190 Referrer referrer_flag, 190 ReferrerValue referrer_flag,
191 bool notify_redirects, 191 bool notify_redirects,
192 bool check_mixed_scripting); 192 bool check_mixed_scripting);
193 193
194 gfx::Rect GetWindowClipRect(const gfx::Rect& rect); 194 gfx::Rect GetWindowClipRect(const gfx::Rect& rect);
195 195
196 // Sets the actual Widget for the plugin. 196 // Sets the actual Widget for the plugin.
197 void SetContainer(blink::WebPluginContainer* container); 197 void SetContainer(blink::WebPluginContainer* container);
198 198
199 // Destroys the plugin instance. 199 // Destroys the plugin instance.
200 // The response_handle_to_ignore parameter if not NULL indicates the 200 // The response_handle_to_ignore parameter if not NULL indicates the
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 bool HandleHttpMultipartResponse(const blink::WebURLResponse& response, 235 bool HandleHttpMultipartResponse(const blink::WebURLResponse& response,
236 WebPluginResourceClient* client); 236 WebPluginResourceClient* client);
237 237
238 void HandleURLRequestInternal(const char* url, 238 void HandleURLRequestInternal(const char* url,
239 const char* method, 239 const char* method,
240 const char* target, 240 const char* target,
241 const char* buf, 241 const char* buf,
242 unsigned int len, 242 unsigned int len,
243 int notify_id, 243 int notify_id,
244 bool popups_allowed, 244 bool popups_allowed,
245 Referrer referrer_flag, 245 ReferrerValue referrer_flag,
246 bool notify_redirects, 246 bool notify_redirects,
247 bool check_mixed_scripting); 247 bool check_mixed_scripting);
248 248
249 // Tears down the existing plugin instance and creates a new plugin instance 249 // Tears down the existing plugin instance and creates a new plugin instance
250 // to handle the response identified by the loader parameter. 250 // to handle the response identified by the loader parameter.
251 bool ReinitializePluginForResponse(blink::WebURLLoader* loader); 251 bool ReinitializePluginForResponse(blink::WebURLLoader* loader);
252 252
253 // Delayed task for downloading the plugin source URL. 253 // Delayed task for downloading the plugin source URL.
254 void OnDownloadPluginSrcUrl(); 254 void OnDownloadPluginSrcUrl();
255 255
256 struct ClientInfo; 256 struct ClientInfo;
257 257
258 // Helper functions 258 // Helper functions
259 WebPluginResourceClient* GetClientFromLoader(blink::WebURLLoader* loader); 259 WebPluginResourceClient* GetClientFromLoader(blink::WebURLLoader* loader);
260 ClientInfo* GetClientInfoFromLoader(blink::WebURLLoader* loader); 260 ClientInfo* GetClientInfoFromLoader(blink::WebURLLoader* loader);
261 261
262 // Helper function to set the referrer on the request passed in. 262 // Helper function to set the referrer on the request passed in.
263 void SetReferrer(blink::WebURLRequest* request, Referrer referrer_flag); 263 void SetReferrer(blink::WebURLRequest* request, ReferrerValue referrer_flag);
264 264
265 // Check for invalid chars like @, ;, \ before the first / (in path). 265 // Check for invalid chars like @, ;, \ before the first / (in path).
266 bool IsValidUrl(const GURL& url, Referrer referrer_flag); 266 bool IsValidUrl(const GURL& url, ReferrerValue referrer_flag);
267 267
268 std::vector<ClientInfo> clients_; 268 std::vector<ClientInfo> clients_;
269 269
270 bool windowless_; 270 bool windowless_;
271 gfx::PluginWindowHandle window_; 271 gfx::PluginWindowHandle window_;
272 #if defined(OS_MACOSX) 272 #if defined(OS_MACOSX)
273 bool next_io_surface_allocated_; 273 bool next_io_surface_allocated_;
274 int32 next_io_surface_width_; 274 int32 next_io_surface_width_;
275 int32 next_io_surface_height_; 275 int32 next_io_surface_height_;
276 uint32 next_io_surface_id_; 276 uint32 next_io_surface_id_;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 LoaderClient loader_client_; 357 LoaderClient loader_client_;
358 358
359 base::WeakPtrFactory<WebPluginImpl> weak_factory_; 359 base::WeakPtrFactory<WebPluginImpl> weak_factory_;
360 360
361 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); 361 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl);
362 }; 362 };
363 363
364 } // namespace content 364 } // namespace content
365 365
366 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ 366 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/npapi/webplugin_delegate_proxy.cc ('k') | content/renderer/npapi/webplugin_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698