| OLD | NEW |
| 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/plugins/npapi/webplugin_impl.h" | 5 #include "webkit/glue/plugins/webplugin_impl.h" |
| 6 | 6 |
| 7 #include "base/linked_ptr.h" | 7 #include "base/linked_ptr.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "gfx/rect.h" | 13 #include "gfx/rect.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 #include "net/base/escape.h" | 15 #include "net/base/escape.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 32 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" | 32 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" |
| 33 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" | 33 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" |
| 34 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 34 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
| 35 #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" | 35 #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" |
| 36 #include "third_party/WebKit/WebKit/chromium/public/WebURLLoader.h" | 36 #include "third_party/WebKit/WebKit/chromium/public/WebURLLoader.h" |
| 37 #include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" | 37 #include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" |
| 38 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" | 38 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" |
| 39 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 39 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 40 #include "webkit/appcache/web_application_cache_host_impl.h" | 40 #include "webkit/appcache/web_application_cache_host_impl.h" |
| 41 #include "webkit/glue/multipart_response_delegate.h" | 41 #include "webkit/glue/multipart_response_delegate.h" |
| 42 #include "webkit/plugins/npapi/plugin_host.h" | 42 #include "webkit/glue/plugins/plugin_host.h" |
| 43 #include "webkit/plugins/npapi/plugin_instance.h" | 43 #include "webkit/glue/plugins/plugin_instance.h" |
| 44 #include "webkit/plugins/npapi/webplugin_delegate.h" | 44 #include "webkit/glue/plugins/webplugin_delegate.h" |
| 45 #include "webkit/plugins/npapi/webplugin_page_delegate.h" | 45 #include "webkit/glue/plugins/webplugin_page_delegate.h" |
| 46 | 46 |
| 47 using appcache::WebApplicationCacheHostImpl; | 47 using appcache::WebApplicationCacheHostImpl; |
| 48 using WebKit::WebCanvas; | 48 using WebKit::WebCanvas; |
| 49 using WebKit::WebConsoleMessage; | 49 using WebKit::WebConsoleMessage; |
| 50 using WebKit::WebCookieJar; | 50 using WebKit::WebCookieJar; |
| 51 using WebKit::WebCString; | 51 using WebKit::WebCString; |
| 52 using WebKit::WebCursorInfo; | 52 using WebKit::WebCursorInfo; |
| 53 using WebKit::WebData; | 53 using WebKit::WebData; |
| 54 using WebKit::WebDataSource; | 54 using WebKit::WebDataSource; |
| 55 using WebKit::WebDevToolsAgent; | 55 using WebKit::WebDevToolsAgent; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 66 using WebKit::WebURL; | 66 using WebKit::WebURL; |
| 67 using WebKit::WebURLError; | 67 using WebKit::WebURLError; |
| 68 using WebKit::WebURLLoader; | 68 using WebKit::WebURLLoader; |
| 69 using WebKit::WebURLLoaderClient; | 69 using WebKit::WebURLLoaderClient; |
| 70 using WebKit::WebURLRequest; | 70 using WebKit::WebURLRequest; |
| 71 using WebKit::WebURLResponse; | 71 using WebKit::WebURLResponse; |
| 72 using WebKit::WebVector; | 72 using WebKit::WebVector; |
| 73 using WebKit::WebView; | 73 using WebKit::WebView; |
| 74 using webkit_glue::MultipartResponseDelegate; | 74 using webkit_glue::MultipartResponseDelegate; |
| 75 | 75 |
| 76 namespace webkit { | 76 namespace webkit_glue { |
| 77 namespace npapi { | |
| 78 | |
| 79 namespace { | 77 namespace { |
| 80 | 78 |
| 81 // This class handles individual multipart responses. It is instantiated when | 79 // This class handles individual multipart responses. It is instantiated when |
| 82 // we receive HTTP status code 206 in the HTTP response. This indicates | 80 // we receive HTTP status code 206 in the HTTP response. This indicates |
| 83 // that the response could have multiple parts each separated by a boundary | 81 // that the response could have multiple parts each separated by a boundary |
| 84 // specified in the response header. | 82 // specified in the response header. |
| 85 class MultiPartResponseClient : public WebURLLoaderClient { | 83 class MultiPartResponseClient : public WebURLLoaderClient { |
| 86 public: | 84 public: |
| 87 explicit MultiPartResponseClient(WebPluginResourceClient* resource_client) | 85 explicit MultiPartResponseClient(WebPluginResourceClient* resource_client) |
| 88 : resource_client_(resource_client) { | 86 : resource_client_(resource_client) { |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 } | 594 } |
| 597 } | 595 } |
| 598 } | 596 } |
| 599 | 597 |
| 600 bool WebPluginImpl::SetPostData(WebURLRequest* request, | 598 bool WebPluginImpl::SetPostData(WebURLRequest* request, |
| 601 const char *buf, | 599 const char *buf, |
| 602 uint32 length) { | 600 uint32 length) { |
| 603 std::vector<std::string> names; | 601 std::vector<std::string> names; |
| 604 std::vector<std::string> values; | 602 std::vector<std::string> values; |
| 605 std::vector<char> body; | 603 std::vector<char> body; |
| 606 bool rv = PluginHost::SetPostData(buf, length, &names, &values, &body); | 604 bool rv = NPAPI::PluginHost::SetPostData(buf, length, &names, &values, &body); |
| 607 | 605 |
| 608 for (size_t i = 0; i < names.size(); ++i) { | 606 for (size_t i = 0; i < names.size(); ++i) { |
| 609 request->addHTTPHeaderField(WebString::fromUTF8(names[i]), | 607 request->addHTTPHeaderField(WebString::fromUTF8(names[i]), |
| 610 WebString::fromUTF8(values[i])); | 608 WebString::fromUTF8(values[i])); |
| 611 } | 609 } |
| 612 | 610 |
| 613 WebString content_type_header = WebString::fromUTF8("Content-Type"); | 611 WebString content_type_header = WebString::fromUTF8("Content-Type"); |
| 614 const WebString& content_type = | 612 const WebString& content_type = |
| 615 request->httpHeaderField(content_type_header); | 613 request->httpHeaderField(content_type_header); |
| 616 if (content_type.isEmpty()) { | 614 if (content_type.isEmpty()) { |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 | 1383 |
| 1386 WebDevToolsAgent* WebPluginImpl::GetDevToolsAgent() { | 1384 WebDevToolsAgent* WebPluginImpl::GetDevToolsAgent() { |
| 1387 if (!webframe_) | 1385 if (!webframe_) |
| 1388 return NULL; | 1386 return NULL; |
| 1389 WebView* view = webframe_->view(); | 1387 WebView* view = webframe_->view(); |
| 1390 if (!view) | 1388 if (!view) |
| 1391 return NULL; | 1389 return NULL; |
| 1392 return view->devToolsAgent(); | 1390 return view->devToolsAgent(); |
| 1393 } | 1391 } |
| 1394 | 1392 |
| 1395 } // namespace npapi | 1393 } // namespace webkit_glue |
| 1396 } // namespace webkit | |
| OLD | NEW |