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

Side by Side Diff: webkit/glue/plugins/pepper_url_loader.cc

Issue 2806049: Allow Pepper plugins to make requests with relative urls. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/pepper_plugin_registry.cc ('k') | webkit/glue/plugins/pepper_url_request_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "webkit/glue/plugins/pepper_url_loader.h" 5 #include "webkit/glue/plugins/pepper_url_loader.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/ppapi/c/pp_completion_callback.h" 8 #include "third_party/ppapi/c/pp_completion_callback.h"
9 #include "third_party/ppapi/c/pp_errors.h" 9 #include "third_party/ppapi/c/pp_errors.h"
10 #include "third_party/ppapi/c/ppb_url_loader.h" 10 #include "third_party/ppapi/c/ppb_url_loader.h"
11 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" 11 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h"
12 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" 12 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h"
13 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 13 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
14 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" 14 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
15 #include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" 15 #include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h"
16 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" 16 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h"
17 #include "webkit/glue/plugins/pepper_plugin_instance.h" 17 #include "webkit/glue/plugins/pepper_plugin_instance.h"
18 #include "webkit/glue/plugins/pepper_url_request_info.h" 18 #include "webkit/glue/plugins/pepper_url_request_info.h"
19 #include "webkit/glue/plugins/pepper_url_response_info.h" 19 #include "webkit/glue/plugins/pepper_url_response_info.h"
20 20
21 using WebKit::WebFrame; 21 using WebKit::WebFrame;
22 using WebKit::WebString;
22 using WebKit::WebURL; 23 using WebKit::WebURL;
23 using WebKit::WebURLError; 24 using WebKit::WebURLError;
24 using WebKit::WebURLLoader; 25 using WebKit::WebURLLoader;
25 using WebKit::WebURLRequest; 26 using WebKit::WebURLRequest;
26 using WebKit::WebURLResponse; 27 using WebKit::WebURLResponse;
27 28
28 #ifdef _MSC_VER 29 #ifdef _MSC_VER
29 // Do not warn about use of std::copy with raw pointers. 30 // Do not warn about use of std::copy with raw pointers.
30 #pragma warning(disable : 4996) 31 #pragma warning(disable : 4996)
31 #endif 32 #endif
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 169
169 // We only support non-blocking calls. 170 // We only support non-blocking calls.
170 if (!callback.func) 171 if (!callback.func)
171 return PP_Error_BadArgument; 172 return PP_Error_BadArgument;
172 173
173 WebURLRequest web_request(request->web_request()); 174 WebURLRequest web_request(request->web_request());
174 175
175 WebFrame* frame = instance_->container()->element().document().frame(); 176 WebFrame* frame = instance_->container()->element().document().frame();
176 if (!frame) 177 if (!frame)
177 return PP_Error_Failed; 178 return PP_Error_Failed;
179 web_request.setURL(
180 frame->document().completeURL(WebString::fromUTF8(request->url())));
178 frame->setReferrerForRequest(web_request, WebURL()); // Use default. 181 frame->setReferrerForRequest(web_request, WebURL()); // Use default.
179 frame->dispatchWillSendRequest(web_request); 182 frame->dispatchWillSendRequest(web_request);
180 183
181 loader_.reset(WebKit::webKitClient()->createURLLoader()); 184 loader_.reset(WebKit::webKitClient()->createURLLoader());
182 if (!loader_.get()) { 185 if (!loader_.get()) {
183 loader_.reset(); 186 loader_.reset();
184 return PP_Error_Failed; 187 return PP_Error_Failed;
185 } 188 }
186 loader_->loadAsynchronously(web_request, this); 189 loader_->loadAsynchronously(web_request, this);
187 190
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 std::copy(buffer_.begin(), buffer_.begin() + bytes_to_copy, user_buffer_); 281 std::copy(buffer_.begin(), buffer_.begin() + bytes_to_copy, user_buffer_);
279 buffer_.erase(buffer_.begin(), buffer_.begin() + bytes_to_copy); 282 buffer_.erase(buffer_.begin(), buffer_.begin() + bytes_to_copy);
280 283
281 // Reset for next time. 284 // Reset for next time.
282 user_buffer_ = NULL; 285 user_buffer_ = NULL;
283 user_buffer_size_ = 0; 286 user_buffer_size_ = 0;
284 return bytes_to_copy; 287 return bytes_to_copy;
285 } 288 }
286 289
287 } // namespace pepper 290 } // namespace pepper
OLDNEW
« no previous file with comments | « chrome/common/pepper_plugin_registry.cc ('k') | webkit/glue/plugins/pepper_url_request_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698