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

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

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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 #include "content/renderer/npapi/webplugin_impl.h" 5 #include "content/renderer/npapi/webplugin_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "third_party/WebKit/public/web/WebPluginContainer.h" 50 #include "third_party/WebKit/public/web/WebPluginContainer.h"
51 #include "third_party/WebKit/public/web/WebPluginParams.h" 51 #include "third_party/WebKit/public/web/WebPluginParams.h"
52 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h" 52 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h"
53 #include "third_party/WebKit/public/web/WebView.h" 53 #include "third_party/WebKit/public/web/WebView.h"
54 #include "ui/gfx/rect.h" 54 #include "ui/gfx/rect.h"
55 #include "url/gurl.h" 55 #include "url/gurl.h"
56 #include "url/url_util.h" 56 #include "url/url_util.h"
57 #include "webkit/child/multipart_response_delegate.h" 57 #include "webkit/child/multipart_response_delegate.h"
58 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" 58 #include "webkit/renderer/compositor_bindings/web_layer_impl.h"
59 59
60 using WebKit::WebCanvas; 60 using blink::WebCanvas;
61 using WebKit::WebConsoleMessage; 61 using blink::WebConsoleMessage;
62 using WebKit::WebCookieJar; 62 using blink::WebCookieJar;
63 using WebKit::WebCString; 63 using blink::WebCString;
64 using WebKit::WebCursorInfo; 64 using blink::WebCursorInfo;
65 using WebKit::WebData; 65 using blink::WebData;
66 using WebKit::WebDataSource; 66 using blink::WebDataSource;
67 using WebKit::WebFrame; 67 using blink::WebFrame;
68 using WebKit::WebHTTPBody; 68 using blink::WebHTTPBody;
69 using WebKit::WebHTTPHeaderVisitor; 69 using blink::WebHTTPHeaderVisitor;
70 using WebKit::WebInputEvent; 70 using blink::WebInputEvent;
71 using WebKit::WebKeyboardEvent; 71 using blink::WebKeyboardEvent;
72 using WebKit::WebMouseEvent; 72 using blink::WebMouseEvent;
73 using WebKit::WebPluginContainer; 73 using blink::WebPluginContainer;
74 using WebKit::WebPluginParams; 74 using blink::WebPluginParams;
75 using WebKit::WebRect; 75 using blink::WebRect;
76 using WebKit::WebString; 76 using blink::WebString;
77 using WebKit::WebURL; 77 using blink::WebURL;
78 using WebKit::WebURLError; 78 using blink::WebURLError;
79 using WebKit::WebURLLoader; 79 using blink::WebURLLoader;
80 using WebKit::WebURLLoaderClient; 80 using blink::WebURLLoaderClient;
81 using WebKit::WebURLLoaderOptions; 81 using blink::WebURLLoaderOptions;
82 using WebKit::WebURLRequest; 82 using blink::WebURLRequest;
83 using WebKit::WebURLResponse; 83 using blink::WebURLResponse;
84 using WebKit::WebVector; 84 using blink::WebVector;
85 using WebKit::WebView; 85 using blink::WebView;
86 using webkit_glue::MultipartResponseDelegate; 86 using webkit_glue::MultipartResponseDelegate;
87 87
88 namespace content { 88 namespace content {
89 89
90 namespace { 90 namespace {
91 91
92 // This class handles individual multipart responses. It is instantiated when 92 // This class handles individual multipart responses. It is instantiated when
93 // we receive HTTP status code 206 in the HTTP response. This indicates 93 // we receive HTTP status code 206 in the HTTP response. This indicates
94 // that the response could have multiple parts each separated by a boundary 94 // that the response could have multiple parts each separated by a boundary
95 // specified in the response header. 95 // specified in the response header.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if (!content_encoding.isNull() && 205 if (!content_encoding.isNull() &&
206 !EqualsASCII(content_encoding, "identity")) { 206 !EqualsASCII(content_encoding, "identity")) {
207 // Don't send the compressed content length to the plugin, which only 207 // Don't send the compressed content length to the plugin, which only
208 // cares about the decoded length. 208 // cares about the decoded length.
209 response_info->expected_length = 0; 209 response_info->expected_length = 0;
210 } 210 }
211 } 211 }
212 212
213 } // namespace 213 } // namespace
214 214
215 // WebKit::WebPlugin ---------------------------------------------------------- 215 // blink::WebPlugin ----------------------------------------------------------
216 216
217 struct WebPluginImpl::ClientInfo { 217 struct WebPluginImpl::ClientInfo {
218 unsigned long id; 218 unsigned long id;
219 WebPluginResourceClient* client; 219 WebPluginResourceClient* client;
220 WebKit::WebURLRequest request; 220 blink::WebURLRequest request;
221 bool pending_failure_notification; 221 bool pending_failure_notification;
222 linked_ptr<WebKit::WebURLLoader> loader; 222 linked_ptr<blink::WebURLLoader> loader;
223 bool notify_redirects; 223 bool notify_redirects;
224 bool is_plugin_src_load; 224 bool is_plugin_src_load;
225 int64 data_offset; 225 int64 data_offset;
226 }; 226 };
227 227
228 bool WebPluginImpl::initialize(WebPluginContainer* container) { 228 bool WebPluginImpl::initialize(WebPluginContainer* container) {
229 if (!render_view_.get()) { 229 if (!render_view_.get()) {
230 LOG(ERROR) << "No RenderView"; 230 LOG(ERROR) << "No RenderView";
231 return false; 231 return false;
232 } 232 }
233 233
234 WebPluginDelegate* plugin_delegate = CreatePluginDelegate(); 234 WebPluginDelegate* plugin_delegate = CreatePluginDelegate();
235 if (!plugin_delegate) 235 if (!plugin_delegate)
236 return false; 236 return false;
237 237
238 // Store the plugin's unique identifier, used by the container to track its 238 // Store the plugin's unique identifier, used by the container to track its
239 // script objects. 239 // script objects.
240 npp_ = plugin_delegate->GetPluginNPP(); 240 npp_ = plugin_delegate->GetPluginNPP();
241 241
242 // Set the container before Initialize because the plugin may 242 // Set the container before Initialize because the plugin may
243 // synchronously call NPN_GetValue to get its container, or make calls 243 // synchronously call NPN_GetValue to get its container, or make calls
244 // passing script objects that need to be tracked, during initialization. 244 // passing script objects that need to be tracked, during initialization.
245 SetContainer(container); 245 SetContainer(container);
246 246
247 bool ok = plugin_delegate->Initialize( 247 bool ok = plugin_delegate->Initialize(
248 plugin_url_, arg_names_, arg_values_, load_manually_); 248 plugin_url_, arg_names_, arg_values_, load_manually_);
249 if (!ok) { 249 if (!ok) {
250 plugin_delegate->PluginDestroyed(); 250 plugin_delegate->PluginDestroyed();
251 251
252 WebKit::WebPlugin* replacement_plugin = 252 blink::WebPlugin* replacement_plugin =
253 GetContentClient()->renderer()->CreatePluginReplacement( 253 GetContentClient()->renderer()->CreatePluginReplacement(
254 render_view_.get(), file_path_); 254 render_view_.get(), file_path_);
255 if (!replacement_plugin) 255 if (!replacement_plugin)
256 return false; 256 return false;
257 257
258 // Disable scripting by this plugin before replacing it with the new 258 // Disable scripting by this plugin before replacing it with the new
259 // one. This plugin also needs destroying, so use destroy(), which will 259 // one. This plugin also needs destroying, so use destroy(), which will
260 // implicitly disable scripting while un-setting the container. 260 // implicitly disable scripting while un-setting the container.
261 destroy(); 261 destroy();
262 262
(...skipping 16 matching lines...) Expand all
279 if (!delegate_) 279 if (!delegate_)
280 return NULL; 280 return NULL;
281 281
282 return delegate_->GetPluginScriptableObject(); 282 return delegate_->GetPluginScriptableObject();
283 } 283 }
284 284
285 NPP WebPluginImpl::pluginNPP() { 285 NPP WebPluginImpl::pluginNPP() {
286 return npp_; 286 return npp_;
287 } 287 }
288 288
289 bool WebPluginImpl::getFormValue(WebKit::WebString& value) { 289 bool WebPluginImpl::getFormValue(blink::WebString& value) {
290 if (!delegate_) 290 if (!delegate_)
291 return false; 291 return false;
292 base::string16 form_value; 292 base::string16 form_value;
293 if (!delegate_->GetFormValue(&form_value)) 293 if (!delegate_->GetFormValue(&form_value))
294 return false; 294 return false;
295 value = form_value; 295 value = form_value;
296 return true; 296 return true;
297 } 297 }
298 298
299 void WebPluginImpl::paint(WebCanvas* canvas, const WebRect& paint_rect) { 299 void WebPluginImpl::paint(WebCanvas* canvas, const WebRect& paint_rect) {
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 1480
1481 client_index = clients_.erase(client_index); 1481 client_index = clients_.erase(client_index);
1482 } 1482 }
1483 1483
1484 // This needs to be called now and not in the destructor since the 1484 // This needs to be called now and not in the destructor since the
1485 // webframe_ might not be valid anymore. 1485 // webframe_ might not be valid anymore.
1486 webframe_ = NULL; 1486 webframe_ = NULL;
1487 weak_factory_.InvalidateWeakPtrs(); 1487 weak_factory_.InvalidateWeakPtrs();
1488 } 1488 }
1489 1489
1490 void WebPluginImpl::SetReferrer(WebKit::WebURLRequest* request, 1490 void WebPluginImpl::SetReferrer(blink::WebURLRequest* request,
1491 Referrer referrer_flag) { 1491 Referrer referrer_flag) {
1492 switch (referrer_flag) { 1492 switch (referrer_flag) {
1493 case DOCUMENT_URL: 1493 case DOCUMENT_URL:
1494 webframe_->setReferrerForRequest(*request, GURL()); 1494 webframe_->setReferrerForRequest(*request, GURL());
1495 break; 1495 break;
1496 1496
1497 case PLUGIN_SRC: 1497 case PLUGIN_SRC:
1498 webframe_->setReferrerForRequest(*request, plugin_url_); 1498 webframe_->setReferrerForRequest(*request, plugin_url_);
1499 break; 1499 break;
1500 1500
1501 default: 1501 default:
1502 break; 1502 break;
1503 } 1503 }
1504 } 1504 }
1505 1505
1506 } // namespace content 1506 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/npapi/webplugin_impl.h ('k') | content/renderer/npapi/webplugin_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698