OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/plugin/webplugin_proxy.h" | 5 #include "content/plugin/webplugin_proxy.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/memory/scoped_handle.h" | 11 #include "base/memory/scoped_handle.h" |
12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/child/npapi/npobject_proxy.h" | 14 #include "content/child/npapi/npobject_proxy.h" |
15 #include "content/child/npapi/npobject_util.h" | 15 #include "content/child/npapi/npobject_util.h" |
16 #include "content/child/npapi/webplugin_delegate_impl.h" | 16 #include "content/child/npapi/webplugin_delegate_impl.h" |
17 #include "content/child/npapi/webplugin_resource_client.h" | |
17 #include "content/child/plugin_messages.h" | 18 #include "content/child/plugin_messages.h" |
18 #include "content/plugin/plugin_channel.h" | 19 #include "content/plugin/plugin_channel.h" |
19 #include "content/plugin/plugin_thread.h" | 20 #include "content/plugin/plugin_thread.h" |
20 #include "content/public/common/content_client.h" | 21 #include "content/public/common/content_client.h" |
21 #include "content/public/common/url_constants.h" | 22 #include "content/public/common/url_constants.h" |
22 #include "skia/ext/platform_canvas.h" | 23 #include "skia/ext/platform_canvas.h" |
23 #include "skia/ext/platform_device.h" | 24 #include "skia/ext/platform_device.h" |
24 #include "third_party/WebKit/public/web/WebBindings.h" | 25 #include "third_party/WebKit/public/web/WebBindings.h" |
25 #include "ui/gfx/blit.h" | 26 #include "ui/gfx/blit.h" |
26 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 &pump_messages_event_for_renderer, | 141 &pump_messages_event_for_renderer, |
141 SYNCHRONIZE | EVENT_MODIFY_STATE, 0); | 142 SYNCHRONIZE | EVENT_MODIFY_STATE, 0); |
142 DCHECK(pump_messages_event_for_renderer); | 143 DCHECK(pump_messages_event_for_renderer); |
143 Send(new PluginHostMsg_SetWindowlessData( | 144 Send(new PluginHostMsg_SetWindowlessData( |
144 route_id_, pump_messages_event_for_renderer, dummy_activation_window)); | 145 route_id_, pump_messages_event_for_renderer, dummy_activation_window)); |
145 } | 146 } |
146 #endif | 147 #endif |
147 | 148 |
148 void WebPluginProxy::CancelResource(unsigned long id) { | 149 void WebPluginProxy::CancelResource(unsigned long id) { |
149 Send(new PluginHostMsg_CancelResource(route_id_, id)); | 150 Send(new PluginHostMsg_CancelResource(route_id_, id)); |
151 | |
ananta
2013/09/11 18:18:09
Remove
| |
150 resource_clients_.erase(id); | 152 resource_clients_.erase(id); |
151 } | 153 } |
152 | 154 |
153 void WebPluginProxy::Invalidate() { | 155 void WebPluginProxy::Invalidate() { |
154 gfx::Rect rect(0, 0, | 156 gfx::Rect rect(0, 0, |
155 delegate_->GetRect().width(), | 157 delegate_->GetRect().width(), |
156 delegate_->GetRect().height()); | 158 delegate_->GetRect().height()); |
157 InvalidateRect(rect); | 159 InvalidateRect(rect); |
158 } | 160 } |
159 | 161 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
669 Paint(damaged_rect); | 671 Paint(damaged_rect); |
670 Send(new PluginHostMsg_InvalidateRect(route_id_, damaged_rect)); | 672 Send(new PluginHostMsg_InvalidateRect(route_id_, damaged_rect)); |
671 } | 673 } |
672 | 674 |
673 bool WebPluginProxy::IsOffTheRecord() { | 675 bool WebPluginProxy::IsOffTheRecord() { |
674 return channel_->incognito(); | 676 return channel_->incognito(); |
675 } | 677 } |
676 | 678 |
677 void WebPluginProxy::ResourceClientDeleted( | 679 void WebPluginProxy::ResourceClientDeleted( |
678 WebPluginResourceClient* resource_client) { | 680 WebPluginResourceClient* resource_client) { |
681 // resource_client->ResourceId() is 0 at this point, so can't use it as an | |
682 // index into the map. | |
679 ResourceClientMap::iterator index = resource_clients_.begin(); | 683 ResourceClientMap::iterator index = resource_clients_.begin(); |
680 while (index != resource_clients_.end()) { | 684 while (index != resource_clients_.end()) { |
681 WebPluginResourceClient* client = (*index).second; | 685 WebPluginResourceClient* client = (*index).second; |
682 | |
683 if (client == resource_client) { | 686 if (client == resource_client) { |
684 resource_clients_.erase(index++); | 687 resource_clients_.erase(index); |
688 return; | |
685 } else { | 689 } else { |
686 index++; | 690 index++; |
687 } | 691 } |
688 } | 692 } |
689 } | 693 } |
690 | 694 |
691 void WebPluginProxy::URLRedirectResponse(bool allow, int resource_id) { | 695 void WebPluginProxy::URLRedirectResponse(bool allow, int resource_id) { |
692 Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id)); | 696 Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id)); |
693 } | 697 } |
694 | 698 |
699 bool WebPluginProxy::CheckIfRunInsecureContent(const GURL& url) { | |
700 bool result = true; | |
701 Send(new PluginHostMsg_CheckIfRunInsecureContent( | |
702 host_render_view_routing_id_, url, &result)); | |
703 return result; | |
704 } | |
705 | |
695 #if defined(OS_WIN) && !defined(USE_AURA) | 706 #if defined(OS_WIN) && !defined(USE_AURA) |
696 void WebPluginProxy::UpdateIMEStatus() { | 707 void WebPluginProxy::UpdateIMEStatus() { |
697 // Retrieve the IME status from a plug-in and send it to a renderer process | 708 // Retrieve the IME status from a plug-in and send it to a renderer process |
698 // when the plug-in has updated it. | 709 // when the plug-in has updated it. |
699 int input_type; | 710 int input_type; |
700 gfx::Rect caret_rect; | 711 gfx::Rect caret_rect; |
701 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) | 712 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) |
702 return; | 713 return; |
703 | 714 |
704 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); | 715 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); |
705 } | 716 } |
706 #endif | 717 #endif |
707 | 718 |
708 } // namespace content | 719 } // namespace content |
OLD | NEW |