| Index: content/plugin/webplugin_proxy.cc
|
| ===================================================================
|
| --- content/plugin/webplugin_proxy.cc (revision 222265)
|
| +++ content/plugin/webplugin_proxy.cc (working copy)
|
| @@ -14,9 +14,11 @@
|
| #include "content/child/npapi/npobject_proxy.h"
|
| #include "content/child/npapi/npobject_util.h"
|
| #include "content/child/npapi/webplugin_delegate_impl.h"
|
| +#include "content/child/npapi/webplugin_resource_client.h"
|
| #include "content/child/plugin_messages.h"
|
| #include "content/plugin/plugin_channel.h"
|
| #include "content/plugin/plugin_thread.h"
|
| +#include "content/plugin/plugin_url_fetcher.h"
|
| #include "content/public/common/content_client.h"
|
| #include "content/public/common/url_constants.h"
|
| #include "skia/ext/platform_canvas.h"
|
| @@ -146,8 +148,15 @@
|
| #endif
|
|
|
| void WebPluginProxy::CancelResource(unsigned long id) {
|
| - Send(new PluginHostMsg_CancelResource(route_id_, id));
|
| - resource_clients_.erase(id);
|
| + if (resource_clients_.count(id)) {
|
| + Send(new PluginHostMsg_CancelResource(route_id_, id));
|
| +
|
| + resource_clients_.erase(id);
|
| + } else if (plugin_url_fetchers_.count(id)) {
|
| + plugin_url_fetchers_[id]->Cancel();
|
| + } else {
|
| + NOTREACHED();
|
| + }
|
| }
|
|
|
| void WebPluginProxy::Invalidate() {
|
| @@ -306,6 +315,20 @@
|
| resource_clients_[resource_id] = client;
|
| }
|
|
|
| +void WebPluginProxy::FetchURL(const PluginMsg_FetchURL_Params& params) {
|
| + // TODO(jam): once we switch over to resource loading always happening in this
|
| + // code path, remove WebPluginResourceClient abstraction.
|
| + WebPluginResourceClient* resource_client = delegate_->CreateResourceClient(
|
| + params.resource_id, params.url, params.notify_id);
|
| +
|
| + DCHECK(plugin_url_fetchers_.find(params.resource_id) ==
|
| + plugin_url_fetchers_.end());
|
| + plugin_url_fetchers_[params.resource_id] = new PluginURLFetcher(
|
| + resource_client, this, params.url, params.first_party_for_cookies,
|
| + params.method, params.post_data, params.referrer, params.notify_redirect,
|
| + params.is_plugin_src_load, channel_->renderer_id(), params.resource_id);
|
| +}
|
| +
|
| void WebPluginProxy::HandleURLRequest(const char* url,
|
| const char* method,
|
| const char* target,
|
| @@ -676,20 +699,39 @@
|
|
|
| void WebPluginProxy::ResourceClientDeleted(
|
| WebPluginResourceClient* resource_client) {
|
| + // resource_client->ResourceId() is 0 at this point, so can't use it as an
|
| + // index into the map.
|
| ResourceClientMap::iterator index = resource_clients_.begin();
|
| while (index != resource_clients_.end()) {
|
| WebPluginResourceClient* client = (*index).second;
|
| -
|
| if (client == resource_client) {
|
| - resource_clients_.erase(index++);
|
| + resource_clients_.erase(index);
|
| + return;
|
| } else {
|
| index++;
|
| }
|
| }
|
| +
|
| + PluginURLFetcherMap::iterator index2 = plugin_url_fetchers_.begin();
|
| + while (index2 != plugin_url_fetchers_.end()) {
|
| + PluginURLFetcher* fetcher = (*index2).second;
|
| + if (fetcher->client() == resource_client) {
|
| + plugin_url_fetchers_.erase(index2);
|
| + return;
|
| + } else {
|
| + index2++;
|
| + }
|
| + }
|
| }
|
|
|
| void WebPluginProxy::URLRedirectResponse(bool allow, int resource_id) {
|
| - Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id));
|
| + if (resource_clients_.count(resource_id)) {
|
| + Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id));
|
| + } else if (plugin_url_fetchers_.count(resource_id)) {
|
| + plugin_url_fetchers_[resource_id]->URLRedirectResponse(allow);
|
| + } else {
|
| + NOTREACHED();
|
| + }
|
| }
|
|
|
| #if defined(OS_WIN) && !defined(USE_AURA)
|
|
|