| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/renderer/webplugin_delegate_proxy.h" | 5 #include "chrome/renderer/webplugin_delegate_proxy.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <atlbase.h> | 10 #include <atlbase.h> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 void WillSendRequest(const GURL& url) { | 90 void WillSendRequest(const GURL& url) { |
| 91 DCHECK(channel_ != NULL); | 91 DCHECK(channel_ != NULL); |
| 92 channel_->Send(new PluginMsg_WillSendRequest(instance_id_, resource_id_, | 92 channel_->Send(new PluginMsg_WillSendRequest(instance_id_, resource_id_, |
| 93 url)); | 93 url)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void DidReceiveResponse(const std::string& mime_type, | 96 void DidReceiveResponse(const std::string& mime_type, |
| 97 const std::string& headers, | 97 const std::string& headers, |
| 98 uint32 expected_length, | 98 uint32 expected_length, |
| 99 uint32 last_modified, | 99 uint32 last_modified, |
| 100 bool request_is_seekable, | 100 bool request_is_seekable) { |
| 101 bool* cancel) { | |
| 102 DCHECK(channel_ != NULL); | 101 DCHECK(channel_ != NULL); |
| 103 PluginMsg_DidReceiveResponseParams params; | 102 PluginMsg_DidReceiveResponseParams params; |
| 104 params.id = resource_id_; | 103 params.id = resource_id_; |
| 105 params.mime_type = mime_type; | 104 params.mime_type = mime_type; |
| 106 params.headers = headers; | 105 params.headers = headers; |
| 107 params.expected_length = expected_length; | 106 params.expected_length = expected_length; |
| 108 params.last_modified = last_modified; | 107 params.last_modified = last_modified; |
| 109 params.request_is_seekable = request_is_seekable; | 108 params.request_is_seekable = request_is_seekable; |
| 110 // Grab a reference on the underlying channel so it does not get | 109 // Grab a reference on the underlying channel so it does not get |
| 111 // deleted from under us. | 110 // deleted from under us. |
| 112 scoped_refptr<PluginChannelHost> channel_ref(channel_); | 111 scoped_refptr<PluginChannelHost> channel_ref(channel_); |
| 113 channel_->Send(new PluginMsg_DidReceiveResponse(instance_id_, params, | 112 channel_->Send(new PluginMsg_DidReceiveResponse(instance_id_, params)); |
| 114 cancel)); | |
| 115 } | 113 } |
| 116 | 114 |
| 117 void DidReceiveData(const char* buffer, int length, int data_offset) { | 115 void DidReceiveData(const char* buffer, int length, int data_offset) { |
| 118 DCHECK(channel_ != NULL); | 116 DCHECK(channel_ != NULL); |
| 119 DCHECK(length > 0); | 117 DCHECK(length > 0); |
| 120 std::vector<char> data; | 118 std::vector<char> data; |
| 121 data.resize(static_cast<size_t>(length)); | 119 data.resize(static_cast<size_t>(length)); |
| 122 memcpy(&data.front(), buffer, length); | 120 memcpy(&data.front(), buffer, length); |
| 123 // Grab a reference on the underlying channel so it does not get | 121 // Grab a reference on the underlying channel so it does not get |
| 124 // deleted from under us. | 122 // deleted from under us. |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 IPC_MESSAGE_HANDLER(PluginHostMsg_GetDragData, OnGetDragData); | 370 IPC_MESSAGE_HANDLER(PluginHostMsg_GetDragData, OnGetDragData); |
| 373 IPC_MESSAGE_HANDLER(PluginHostMsg_SetDropEffect, OnSetDropEffect); | 371 IPC_MESSAGE_HANDLER(PluginHostMsg_SetDropEffect, OnSetDropEffect); |
| 374 IPC_MESSAGE_HANDLER(PluginHostMsg_MissingPluginStatus, | 372 IPC_MESSAGE_HANDLER(PluginHostMsg_MissingPluginStatus, |
| 375 OnMissingPluginStatus) | 373 OnMissingPluginStatus) |
| 376 IPC_MESSAGE_HANDLER(PluginHostMsg_URLRequest, OnHandleURLRequest) | 374 IPC_MESSAGE_HANDLER(PluginHostMsg_URLRequest, OnHandleURLRequest) |
| 377 IPC_MESSAGE_HANDLER(PluginHostMsg_GetCPBrowsingContext, | 375 IPC_MESSAGE_HANDLER(PluginHostMsg_GetCPBrowsingContext, |
| 378 OnGetCPBrowsingContext) | 376 OnGetCPBrowsingContext) |
| 379 IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad) | 377 IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad) |
| 380 IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest, | 378 IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest, |
| 381 OnInitiateHTTPRangeRequest) | 379 OnInitiateHTTPRangeRequest) |
| 380 IPC_MESSAGE_HANDLER(PluginHostMsg_DeferResourceLoading, |
| 381 OnDeferResourceLoading) |
| 382 IPC_MESSAGE_UNHANDLED_ERROR() | 382 IPC_MESSAGE_UNHANDLED_ERROR() |
| 383 IPC_END_MESSAGE_MAP() | 383 IPC_END_MESSAGE_MAP() |
| 384 } | 384 } |
| 385 | 385 |
| 386 void WebPluginDelegateProxy::OnChannelError() { | 386 void WebPluginDelegateProxy::OnChannelError() { |
| 387 if (plugin_) | 387 if (plugin_) |
| 388 plugin_->Invalidate(); | 388 plugin_->Invalidate(); |
| 389 render_view_->PluginCrashed(GetProcessId(), plugin_path_); | 389 render_view_->PluginCrashed(GetProcessId(), plugin_path_); |
| 390 } | 390 } |
| 391 | 391 |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 plugin_->CancelDocumentLoad(); | 1011 plugin_->CancelDocumentLoad(); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( | 1014 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( |
| 1015 const std::string& url, const std::string& range_info, | 1015 const std::string& url, const std::string& range_info, |
| 1016 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { | 1016 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { |
| 1017 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), | 1017 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), |
| 1018 existing_stream, notify_needed, | 1018 existing_stream, notify_needed, |
| 1019 notify_data); | 1019 notify_data); |
| 1020 } | 1020 } |
| 1021 |
| 1022 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, |
| 1023 bool defer) { |
| 1024 plugin_->SetDeferResourceLoading(resource_id, defer); |
| 1025 } |
| OLD | NEW |