OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "skia/ext/platform_canvas.h" | 30 #include "skia/ext/platform_canvas.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
42 #include "ui/gfx/rect.h" | 43 #include "ui/gfx/rect.h" |
43 #include "ui/gfx/skia_util.h" | 44 #include "ui/gfx/skia_util.h" |
44 #include "webkit/plugins/ppapi/common.h" | 45 #include "webkit/plugins/ppapi/common.h" |
45 #include "webkit/plugins/ppapi/event_conversion.h" | 46 #include "webkit/plugins/ppapi/event_conversion.h" |
46 #include "webkit/plugins/ppapi/fullscreen_container.h" | 47 #include "webkit/plugins/ppapi/fullscreen_container.h" |
47 #include "webkit/plugins/ppapi/message_channel.h" | 48 #include "webkit/plugins/ppapi/message_channel.h" |
48 #include "webkit/plugins/ppapi/plugin_delegate.h" | 49 #include "webkit/plugins/ppapi/plugin_delegate.h" |
49 #include "webkit/plugins/ppapi/plugin_module.h" | 50 #include "webkit/plugins/ppapi/plugin_module.h" |
50 #include "webkit/plugins/ppapi/plugin_object.h" | 51 #include "webkit/plugins/ppapi/plugin_object.h" |
51 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" | 52 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" |
52 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 53 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
53 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 54 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
54 #include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" | 55 #include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" |
55 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" | 56 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" |
| 57 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" |
56 #include "webkit/plugins/ppapi/ppp_pdf.h" | 58 #include "webkit/plugins/ppapi/ppp_pdf.h" |
57 #include "webkit/plugins/ppapi/string.h" | 59 #include "webkit/plugins/ppapi/string.h" |
58 #include "webkit/plugins/ppapi/var.h" | 60 #include "webkit/plugins/ppapi/var.h" |
59 #include "webkit/plugins/sad_plugin.h" | 61 #include "webkit/plugins/sad_plugin.h" |
60 | 62 |
61 #if defined(OS_POSIX) | 63 #if defined(OS_POSIX) |
62 #include "printing/native_metafile.h" | 64 #include "printing/native_metafile.h" |
63 #endif | 65 #endif |
64 | 66 |
65 #if defined(OS_MACOSX) | 67 #if defined(OS_MACOSX) |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 fullscreen_ = false; | 1125 fullscreen_ = false; |
1124 if (!delay_report) { | 1126 if (!delay_report) { |
1125 ReportGeometry(); | 1127 ReportGeometry(); |
1126 } else { | 1128 } else { |
1127 MessageLoop::current()->PostTask( | 1129 MessageLoop::current()->PostTask( |
1128 FROM_HERE, NewRunnableMethod(this, &PluginInstance::ReportGeometry)); | 1130 FROM_HERE, NewRunnableMethod(this, &PluginInstance::ReportGeometry)); |
1129 } | 1131 } |
1130 } | 1132 } |
1131 } | 1133 } |
1132 | 1134 |
1133 bool PluginInstance::NavigateToURL(const char* url, const char* target) { | 1135 int32_t PluginInstance::Navigate(PPB_URLRequestInfo_Impl* request, |
1134 if (!url || !target || !container_) | 1136 const char* target, |
1135 return false; | 1137 bool from_user_action) { |
| 1138 if (!container_) |
| 1139 return PP_ERROR_FAILED; |
1136 | 1140 |
1137 WebDocument document = container_->element().document(); | 1141 WebDocument document = container_->element().document(); |
1138 GURL complete_url = document.completeURL(WebString::fromUTF8(url)); | 1142 WebFrame* frame = document.frame(); |
1139 // Don't try to deal with the security issues of javascript. | 1143 if (!frame) |
1140 if (complete_url.SchemeIs("javascript")) | 1144 return PP_ERROR_FAILED; |
1141 return false; | 1145 WebURLRequest web_request(request->ToWebURLRequest(frame)); |
| 1146 web_request.setFirstPartyForCookies(document.firstPartyForCookies()); |
| 1147 web_request.setHasUserGesture(from_user_action); |
1142 | 1148 |
1143 WebURLRequest request(complete_url); | 1149 if (GURL(web_request.url()).SchemeIs("javascript")) { |
1144 document.frame()->setReferrerForRequest(request, GURL()); | 1150 // TODO(vtl) |
1145 request.setHTTPMethod(WebString::fromUTF8("GET")); | 1151 NOTIMPLEMENTED(); |
1146 request.setFirstPartyForCookies(document.firstPartyForCookies()); | 1152 return PP_ERROR_FAILED; |
1147 request.setHasUserGesture(true); | 1153 } |
| 1154 |
| 1155 // Only GETs and POSTs are supported. |
| 1156 if (web_request.httpMethod() != "GET" && |
| 1157 web_request.httpMethod() != "POST") |
| 1158 return PP_ERROR_BADARGUMENT; |
1148 | 1159 |
1149 WebString target_str = WebString::fromUTF8(target); | 1160 WebString target_str = WebString::fromUTF8(target); |
1150 container_->loadFrameRequest(request, target_str, false, NULL); | 1161 container_->loadFrameRequest(web_request, target_str, false, NULL); |
1151 return true; | 1162 return PP_OK; |
1152 } | 1163 } |
1153 | 1164 |
1154 PluginDelegate::PlatformContext3D* PluginInstance::CreateContext3D() { | 1165 PluginDelegate::PlatformContext3D* PluginInstance::CreateContext3D() { |
1155 if (fullscreen_container_) | 1166 if (fullscreen_container_) |
1156 return fullscreen_container_->CreateContext3D(); | 1167 return fullscreen_container_->CreateContext3D(); |
1157 else | 1168 else |
1158 return delegate_->CreateContext3D(); | 1169 return delegate_->CreateContext3D(); |
1159 } | 1170 } |
1160 | 1171 |
1161 bool PluginInstance::PrintPDFOutput(PP_Resource print_output, | 1172 bool PluginInstance::PrintPDFOutput(PP_Resource print_output, |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 return found->second; | 1460 return found->second; |
1450 } | 1461 } |
1451 | 1462 |
1452 bool PluginInstance::IsFullPagePlugin() const { | 1463 bool PluginInstance::IsFullPagePlugin() const { |
1453 WebFrame* frame = container()->element().document().frame(); | 1464 WebFrame* frame = container()->element().document().frame(); |
1454 return frame->view()->mainFrame()->document().isPluginDocument(); | 1465 return frame->view()->mainFrame()->document().isPluginDocument(); |
1455 } | 1466 } |
1456 | 1467 |
1457 } // namespace ppapi | 1468 } // namespace ppapi |
1458 } // namespace webkit | 1469 } // namespace webkit |
OLD | NEW |