| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/plugin/webplugin_proxy.h" | 5 #include "chrome/plugin/webplugin_proxy.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
| 9 #include "app/win_util.h" | 9 #include "app/win_util.h" |
| 10 #endif | 10 #endif |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 return cp_browsing_context_; | 232 return cp_browsing_context_; |
| 233 } | 233 } |
| 234 | 234 |
| 235 WebPluginProxy* WebPluginProxy::FromCPBrowsingContext( | 235 WebPluginProxy* WebPluginProxy::FromCPBrowsingContext( |
| 236 CPBrowsingContext context) { | 236 CPBrowsingContext context) { |
| 237 return GetContextMap()[context]; | 237 return GetContextMap()[context]; |
| 238 } | 238 } |
| 239 | 239 |
| 240 WebPluginResourceClient* WebPluginProxy::GetResourceClient(int id) { | 240 WebPluginResourceClient* WebPluginProxy::GetResourceClient(int id) { |
| 241 ResourceClientMap::iterator iterator = resource_clients_.find(id); | 241 ResourceClientMap::iterator iterator = resource_clients_.find(id); |
| 242 // The IPC messages which deal with streams are now asynchronous. It is |
| 243 // now possible to receive stream messages from the renderer for streams |
| 244 // which may have been cancelled by the plugin. |
| 242 if (iterator == resource_clients_.end()) { | 245 if (iterator == resource_clients_.end()) { |
| 243 NOTREACHED(); | |
| 244 return NULL; | 246 return NULL; |
| 245 } | 247 } |
| 246 | 248 |
| 247 return iterator->second; | 249 return iterator->second; |
| 248 } | 250 } |
| 249 | 251 |
| 250 int WebPluginProxy::GetRendererProcessId() { | 252 int WebPluginProxy::GetRendererProcessId() { |
| 251 if (channel_.get()) | 253 if (channel_.get()) |
| 252 return channel_->peer_pid(); | 254 return channel_->peer_pid(); |
| 253 return 0; | 255 return 0; |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 const char* range_info, | 584 const char* range_info, |
| 583 intptr_t existing_stream, | 585 intptr_t existing_stream, |
| 584 bool notify_needed, | 586 bool notify_needed, |
| 585 intptr_t notify_data) { | 587 intptr_t notify_data) { |
| 586 | 588 |
| 587 Send(new PluginHostMsg_InitiateHTTPRangeRequest(route_id_, url, | 589 Send(new PluginHostMsg_InitiateHTTPRangeRequest(route_id_, url, |
| 588 range_info, existing_stream, | 590 range_info, existing_stream, |
| 589 notify_needed, notify_data)); | 591 notify_needed, notify_data)); |
| 590 } | 592 } |
| 591 | 593 |
| 594 void WebPluginProxy::SetDeferResourceLoading(int resource_id, bool defer) { |
| 595 Send(new PluginHostMsg_DeferResourceLoading(route_id_, resource_id, defer)); |
| 596 } |
| 597 |
| 592 void WebPluginProxy::OnPaint(const gfx::Rect& damaged_rect) { | 598 void WebPluginProxy::OnPaint(const gfx::Rect& damaged_rect) { |
| 593 child_process_logging::ScopedActiveURLSetter url_setter(page_url_); | 599 child_process_logging::ScopedActiveURLSetter url_setter(page_url_); |
| 594 | 600 |
| 595 Paint(damaged_rect); | 601 Paint(damaged_rect); |
| 596 Send(new PluginHostMsg_InvalidateRect(route_id_, damaged_rect)); | 602 Send(new PluginHostMsg_InvalidateRect(route_id_, damaged_rect)); |
| 597 } | 603 } |
| 598 | 604 |
| 599 bool WebPluginProxy::IsOffTheRecord() { | 605 bool WebPluginProxy::IsOffTheRecord() { |
| 600 return channel_->off_the_record(); | 606 return channel_->off_the_record(); |
| 601 } | 607 } |
| 602 | 608 |
| 603 void WebPluginProxy::ResourceClientDeleted( | 609 void WebPluginProxy::ResourceClientDeleted( |
| 604 WebPluginResourceClient* resource_client) { | 610 WebPluginResourceClient* resource_client) { |
| 605 ResourceClientMap::iterator index = resource_clients_.begin(); | 611 ResourceClientMap::iterator index = resource_clients_.begin(); |
| 606 while (index != resource_clients_.end()) { | 612 while (index != resource_clients_.end()) { |
| 607 WebPluginResourceClient* client = (*index).second; | 613 WebPluginResourceClient* client = (*index).second; |
| 608 | 614 |
| 609 if (client == resource_client) { | 615 if (client == resource_client) { |
| 610 resource_clients_.erase(index++); | 616 resource_clients_.erase(index++); |
| 611 } else { | 617 } else { |
| 612 index++; | 618 index++; |
| 613 } | 619 } |
| 614 } | 620 } |
| 615 } | 621 } |
| OLD | NEW |