OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper_plugin_delegate_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 return false; | 949 return false; |
950 return focused_plugin_->IsPluginAcceptingCompositionEvents(); | 950 return focused_plugin_->IsPluginAcceptingCompositionEvents(); |
951 } | 951 } |
952 | 952 |
953 bool PepperPluginDelegateImpl::CanComposeInline() const { | 953 bool PepperPluginDelegateImpl::CanComposeInline() const { |
954 return IsPluginAcceptingCompositionEvents(); | 954 return IsPluginAcceptingCompositionEvents(); |
955 } | 955 } |
956 | 956 |
957 void PepperPluginDelegateImpl::PluginCrashed( | 957 void PepperPluginDelegateImpl::PluginCrashed( |
958 webkit::ppapi::PluginInstance* instance) { | 958 webkit::ppapi::PluginInstance* instance) { |
959 subscribed_to_policy_updates_.erase(instance); | |
960 render_view_->PluginCrashed(instance->module()->path()); | 959 render_view_->PluginCrashed(instance->module()->path()); |
961 | 960 |
962 UnlockMouse(instance); | 961 UnlockMouse(instance); |
963 } | 962 } |
964 | 963 |
965 void PepperPluginDelegateImpl::InstanceCreated( | 964 void PepperPluginDelegateImpl::InstanceCreated( |
966 webkit::ppapi::PluginInstance* instance) { | 965 webkit::ppapi::PluginInstance* instance) { |
967 active_instances_.insert(instance); | 966 active_instances_.insert(instance); |
968 | 967 |
969 // Set the initial focus. | 968 // Set the initial focus. |
970 instance->SetContentAreaFocus(render_view_->has_focus()); | 969 instance->SetContentAreaFocus(render_view_->has_focus()); |
971 } | 970 } |
972 | 971 |
973 void PepperPluginDelegateImpl::InstanceDeleted( | 972 void PepperPluginDelegateImpl::InstanceDeleted( |
974 webkit::ppapi::PluginInstance* instance) { | 973 webkit::ppapi::PluginInstance* instance) { |
975 active_instances_.erase(instance); | 974 active_instances_.erase(instance); |
976 subscribed_to_policy_updates_.erase(instance); | |
977 | 975 |
978 if (mouse_lock_owner_ && mouse_lock_owner_ == instance) { | 976 if (mouse_lock_owner_ && mouse_lock_owner_ == instance) { |
979 // UnlockMouse() will determine whether a ViewHostMsg_UnlockMouse needs to | 977 // UnlockMouse() will determine whether a ViewHostMsg_UnlockMouse needs to |
980 // be sent, and set internal state properly. We only need to forget about | 978 // be sent, and set internal state properly. We only need to forget about |
981 // the current |mouse_lock_owner_|. | 979 // the current |mouse_lock_owner_|. |
982 UnlockMouse(mouse_lock_owner_); | 980 UnlockMouse(mouse_lock_owner_); |
983 mouse_lock_owner_ = NULL; | 981 mouse_lock_owner_ = NULL; |
984 } | 982 } |
985 if (last_mouse_event_target_ == instance) | 983 if (last_mouse_event_target_ == instance) |
986 last_mouse_event_target_ = NULL; | 984 last_mouse_event_target_ = NULL; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 } | 1270 } |
1273 | 1271 |
1274 bool PepperPluginDelegateImpl::ReadDirectory( | 1272 bool PepperPluginDelegateImpl::ReadDirectory( |
1275 const GURL& directory_path, | 1273 const GURL& directory_path, |
1276 fileapi::FileSystemCallbackDispatcher* dispatcher) { | 1274 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
1277 FileSystemDispatcher* file_system_dispatcher = | 1275 FileSystemDispatcher* file_system_dispatcher = |
1278 ChildThread::current()->file_system_dispatcher(); | 1276 ChildThread::current()->file_system_dispatcher(); |
1279 return file_system_dispatcher->ReadDirectory(directory_path, dispatcher); | 1277 return file_system_dispatcher->ReadDirectory(directory_path, dispatcher); |
1280 } | 1278 } |
1281 | 1279 |
1282 void PepperPluginDelegateImpl::PublishPolicy(const std::string& policy_json) { | |
1283 for (std::set<webkit::ppapi::PluginInstance*>::iterator i = | |
1284 subscribed_to_policy_updates_.begin(); | |
1285 i != subscribed_to_policy_updates_.end(); ++i) | |
1286 (*i)->HandlePolicyUpdate(policy_json); | |
1287 } | |
1288 | |
1289 void PepperPluginDelegateImpl::QueryAvailableSpace( | 1280 void PepperPluginDelegateImpl::QueryAvailableSpace( |
1290 const GURL& origin, quota::StorageType type, | 1281 const GURL& origin, quota::StorageType type, |
1291 const AvailableSpaceCallback& callback) { | 1282 const AvailableSpaceCallback& callback) { |
1292 ChildThread::current()->quota_dispatcher()->QueryStorageUsageAndQuota( | 1283 ChildThread::current()->quota_dispatcher()->QueryStorageUsageAndQuota( |
1293 origin, type, new QuotaCallbackTranslator(callback)); | 1284 origin, type, new QuotaCallbackTranslator(callback)); |
1294 } | 1285 } |
1295 | 1286 |
1296 void PepperPluginDelegateImpl::WillUpdateFile(const GURL& path) { | 1287 void PepperPluginDelegateImpl::WillUpdateFile(const GURL& path) { |
1297 ChildThread::current()->Send(new FileSystemHostMsg_WillUpdate(path)); | 1288 ChildThread::current()->Send(new FileSystemHostMsg_WillUpdate(path)); |
1298 } | 1289 } |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 return content::GetContentClient()->renderer()->GetDefaultEncoding(); | 1572 return content::GetContentClient()->renderer()->GetDefaultEncoding(); |
1582 } | 1573 } |
1583 | 1574 |
1584 void PepperPluginDelegateImpl::ZoomLimitsChanged(double minimum_factor, | 1575 void PepperPluginDelegateImpl::ZoomLimitsChanged(double minimum_factor, |
1585 double maximum_factor) { | 1576 double maximum_factor) { |
1586 double minimum_level = WebView::zoomFactorToZoomLevel(minimum_factor); | 1577 double minimum_level = WebView::zoomFactorToZoomLevel(minimum_factor); |
1587 double maximum_level = WebView::zoomFactorToZoomLevel(maximum_factor); | 1578 double maximum_level = WebView::zoomFactorToZoomLevel(maximum_factor); |
1588 render_view_->webview()->zoomLimitsChanged(minimum_level, maximum_level); | 1579 render_view_->webview()->zoomLimitsChanged(minimum_level, maximum_level); |
1589 } | 1580 } |
1590 | 1581 |
1591 void PepperPluginDelegateImpl::SubscribeToPolicyUpdates( | |
1592 webkit::ppapi::PluginInstance* instance) { | |
1593 subscribed_to_policy_updates_.insert(instance); | |
1594 | |
1595 // TODO(ajwong): Make this only send an update to the current instance, | |
1596 // and not all subscribed plugin instances. | |
1597 render_view_->RequestRemoteAccessClientFirewallTraversal(); | |
1598 } | |
1599 | |
1600 std::string PepperPluginDelegateImpl::ResolveProxy(const GURL& url) { | 1582 std::string PepperPluginDelegateImpl::ResolveProxy(const GURL& url) { |
1601 bool result; | 1583 bool result; |
1602 std::string proxy_result; | 1584 std::string proxy_result; |
1603 RenderThreadImpl::current()->Send( | 1585 RenderThreadImpl::current()->Send( |
1604 new ViewHostMsg_ResolveProxy(url, &result, &proxy_result)); | 1586 new ViewHostMsg_ResolveProxy(url, &result, &proxy_result)); |
1605 return proxy_result; | 1587 return proxy_result; |
1606 } | 1588 } |
1607 | 1589 |
1608 void PepperPluginDelegateImpl::DidStartLoading() { | 1590 void PepperPluginDelegateImpl::DidStartLoading() { |
1609 render_view_->DidStartLoadingForPlugin(); | 1591 render_view_->DidStartLoadingForPlugin(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 if (!context) | 1731 if (!context) |
1750 return NULL; | 1732 return NULL; |
1751 if (!context->makeContextCurrent() || context->isContextLost()) | 1733 if (!context->makeContextCurrent() || context->isContextLost()) |
1752 return NULL; | 1734 return NULL; |
1753 | 1735 |
1754 RendererGLContext* parent_context = context->context(); | 1736 RendererGLContext* parent_context = context->context(); |
1755 if (!parent_context) | 1737 if (!parent_context) |
1756 return NULL; | 1738 return NULL; |
1757 return parent_context; | 1739 return parent_context; |
1758 } | 1740 } |
1759 | |
1760 void PepperPluginDelegateImpl::PublishInitialPolicy( | |
1761 scoped_refptr<webkit::ppapi::PluginInstance> instance, | |
1762 const std::string& policy) { | |
1763 instance->HandlePolicyUpdate(policy); | |
1764 } | |
OLD | NEW |