| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 void WillSendRequest(const GURL& url) { | 93 void WillSendRequest(const GURL& url) { |
| 94 DCHECK(channel_ != NULL); | 94 DCHECK(channel_ != NULL); |
| 95 channel_->Send(new PluginMsg_WillSendRequest(instance_id_, resource_id_, | 95 channel_->Send(new PluginMsg_WillSendRequest(instance_id_, resource_id_, |
| 96 url)); | 96 url)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void DidReceiveResponse(const std::string& mime_type, | 99 void DidReceiveResponse(const std::string& mime_type, |
| 100 const std::string& headers, | 100 const std::string& headers, |
| 101 uint32 expected_length, | 101 uint32 expected_length, |
| 102 uint32 last_modified, | 102 uint32 last_modified, |
| 103 bool request_is_seekable, | 103 bool request_is_seekable) { |
| 104 bool* cancel) { | |
| 105 DCHECK(channel_ != NULL); | 104 DCHECK(channel_ != NULL); |
| 106 PluginMsg_DidReceiveResponseParams params; | 105 PluginMsg_DidReceiveResponseParams params; |
| 107 params.id = resource_id_; | 106 params.id = resource_id_; |
| 108 params.mime_type = mime_type; | 107 params.mime_type = mime_type; |
| 109 params.headers = headers; | 108 params.headers = headers; |
| 110 params.expected_length = expected_length; | 109 params.expected_length = expected_length; |
| 111 params.last_modified = last_modified; | 110 params.last_modified = last_modified; |
| 112 params.request_is_seekable = request_is_seekable; | 111 params.request_is_seekable = request_is_seekable; |
| 113 // Grab a reference on the underlying channel so it does not get | 112 // Grab a reference on the underlying channel so it does not get |
| 114 // deleted from under us. | 113 // deleted from under us. |
| 115 scoped_refptr<PluginChannelHost> channel_ref(channel_); | 114 scoped_refptr<PluginChannelHost> channel_ref(channel_); |
| 116 channel_->Send(new PluginMsg_DidReceiveResponse(instance_id_, params, | 115 channel_->Send(new PluginMsg_DidReceiveResponse(instance_id_, params)); |
| 117 cancel)); | |
| 118 } | 116 } |
| 119 | 117 |
| 120 void DidReceiveData(const char* buffer, int length, int data_offset) { | 118 void DidReceiveData(const char* buffer, int length, int data_offset) { |
| 121 DCHECK(channel_ != NULL); | 119 DCHECK(channel_ != NULL); |
| 122 DCHECK(length > 0); | 120 DCHECK(length > 0); |
| 123 std::vector<char> data; | 121 std::vector<char> data; |
| 124 data.resize(static_cast<size_t>(length)); | 122 data.resize(static_cast<size_t>(length)); |
| 125 memcpy(&data.front(), buffer, length); | 123 memcpy(&data.front(), buffer, length); |
| 126 // Grab a reference on the underlying channel so it does not get | 124 // Grab a reference on the underlying channel so it does not get |
| 127 // deleted from under us. | 125 // deleted from under us. |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 IPC_MESSAGE_HANDLER(PluginHostMsg_GetDragData, OnGetDragData); | 372 IPC_MESSAGE_HANDLER(PluginHostMsg_GetDragData, OnGetDragData); |
| 375 IPC_MESSAGE_HANDLER(PluginHostMsg_SetDropEffect, OnSetDropEffect); | 373 IPC_MESSAGE_HANDLER(PluginHostMsg_SetDropEffect, OnSetDropEffect); |
| 376 IPC_MESSAGE_HANDLER(PluginHostMsg_MissingPluginStatus, | 374 IPC_MESSAGE_HANDLER(PluginHostMsg_MissingPluginStatus, |
| 377 OnMissingPluginStatus) | 375 OnMissingPluginStatus) |
| 378 IPC_MESSAGE_HANDLER(PluginHostMsg_URLRequest, OnHandleURLRequest) | 376 IPC_MESSAGE_HANDLER(PluginHostMsg_URLRequest, OnHandleURLRequest) |
| 379 IPC_MESSAGE_HANDLER(PluginHostMsg_GetCPBrowsingContext, | 377 IPC_MESSAGE_HANDLER(PluginHostMsg_GetCPBrowsingContext, |
| 380 OnGetCPBrowsingContext) | 378 OnGetCPBrowsingContext) |
| 381 IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad) | 379 IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad) |
| 382 IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest, | 380 IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest, |
| 383 OnInitiateHTTPRangeRequest) | 381 OnInitiateHTTPRangeRequest) |
| 382 IPC_MESSAGE_HANDLER(PluginHostMsg_DeferResourceLoading, |
| 383 OnDeferResourceLoading) |
| 384 IPC_MESSAGE_UNHANDLED_ERROR() | 384 IPC_MESSAGE_UNHANDLED_ERROR() |
| 385 IPC_END_MESSAGE_MAP() | 385 IPC_END_MESSAGE_MAP() |
| 386 } | 386 } |
| 387 | 387 |
| 388 void WebPluginDelegateProxy::OnChannelError() { | 388 void WebPluginDelegateProxy::OnChannelError() { |
| 389 if (plugin_) | 389 if (plugin_) |
| 390 plugin_->Invalidate(); | 390 plugin_->Invalidate(); |
| 391 render_view_->PluginCrashed(GetProcessId(), plugin_path_); | 391 render_view_->PluginCrashed(GetProcessId(), plugin_path_); |
| 392 } | 392 } |
| 393 | 393 |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 plugin_->CancelDocumentLoad(); | 978 plugin_->CancelDocumentLoad(); |
| 979 } | 979 } |
| 980 | 980 |
| 981 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( | 981 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( |
| 982 const std::string& url, const std::string& range_info, | 982 const std::string& url, const std::string& range_info, |
| 983 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { | 983 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { |
| 984 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), | 984 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), |
| 985 existing_stream, notify_needed, | 985 existing_stream, notify_needed, |
| 986 notify_data); | 986 notify_data); |
| 987 } | 987 } |
| 988 |
| 989 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, |
| 990 bool defer) { |
| 991 plugin_->SetDeferResourceLoading(resource_id, defer); |
| 992 } |
| OLD | NEW |