| 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/renderer/pepper/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 } | 1356 } |
| 1357 return new base::SharedMemory(handle, false); | 1357 return new base::SharedMemory(handle, false); |
| 1358 } | 1358 } |
| 1359 | 1359 |
| 1360 ppapi::Preferences PepperPluginDelegateImpl::GetPreferences() { | 1360 ppapi::Preferences PepperPluginDelegateImpl::GetPreferences() { |
| 1361 return ppapi::Preferences(render_view_->webkit_preferences()); | 1361 return ppapi::Preferences(render_view_->webkit_preferences()); |
| 1362 } | 1362 } |
| 1363 | 1363 |
| 1364 bool PepperPluginDelegateImpl::LockMouse( | 1364 bool PepperPluginDelegateImpl::LockMouse( |
| 1365 webkit::ppapi::PluginInstance* instance) { | 1365 webkit::ppapi::PluginInstance* instance) { |
| 1366 | 1366 return GetMouseLockDispatcher(instance)->LockMouse( |
| 1367 return render_view_->mouse_lock_dispatcher()->LockMouse( | |
| 1368 GetOrCreateLockTargetAdapter(instance)); | 1367 GetOrCreateLockTargetAdapter(instance)); |
| 1369 } | 1368 } |
| 1370 | 1369 |
| 1371 void PepperPluginDelegateImpl::UnlockMouse( | 1370 void PepperPluginDelegateImpl::UnlockMouse( |
| 1372 webkit::ppapi::PluginInstance* instance) { | 1371 webkit::ppapi::PluginInstance* instance) { |
| 1373 render_view_->mouse_lock_dispatcher()->UnlockMouse( | 1372 GetMouseLockDispatcher(instance)->UnlockMouse( |
| 1374 GetOrCreateLockTargetAdapter(instance)); | 1373 GetOrCreateLockTargetAdapter(instance)); |
| 1375 } | 1374 } |
| 1376 | 1375 |
| 1377 bool PepperPluginDelegateImpl::IsMouseLocked( | 1376 bool PepperPluginDelegateImpl::IsMouseLocked( |
| 1378 webkit::ppapi::PluginInstance* instance) { | 1377 webkit::ppapi::PluginInstance* instance) { |
| 1379 return render_view_->mouse_lock_dispatcher()->IsMouseLockedTo( | 1378 return GetMouseLockDispatcher(instance)->IsMouseLockedTo( |
| 1380 GetOrCreateLockTargetAdapter(instance)); | 1379 GetOrCreateLockTargetAdapter(instance)); |
| 1381 } | 1380 } |
| 1382 | 1381 |
| 1383 void PepperPluginDelegateImpl::DidChangeCursor( | 1382 void PepperPluginDelegateImpl::DidChangeCursor( |
| 1384 webkit::ppapi::PluginInstance* instance, | 1383 webkit::ppapi::PluginInstance* instance, |
| 1385 const WebKit::WebCursorInfo& cursor) { | 1384 const WebKit::WebCursorInfo& cursor) { |
| 1386 // Update the cursor appearance immediately if the requesting plugin is the | 1385 // Update the cursor appearance immediately if the requesting plugin is the |
| 1387 // one which receives the last mouse event. Otherwise, the new cursor won't be | 1386 // one which receives the last mouse event. Otherwise, the new cursor won't be |
| 1388 // picked up until the plugin gets the next input event. That is bad if, e.g., | 1387 // picked up until the plugin gets the next input event. That is bad if, e.g., |
| 1389 // the plugin would like to set an invisible cursor when there isn't any user | 1388 // the plugin would like to set an invisible cursor when there isn't any user |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 | 1671 |
| 1673 return mouse_lock_instances_[instance] = | 1672 return mouse_lock_instances_[instance] = |
| 1674 new PluginInstanceLockTarget(instance); | 1673 new PluginInstanceLockTarget(instance); |
| 1675 } | 1674 } |
| 1676 | 1675 |
| 1677 void PepperPluginDelegateImpl::UnSetAndDeleteLockTargetAdapter( | 1676 void PepperPluginDelegateImpl::UnSetAndDeleteLockTargetAdapter( |
| 1678 webkit::ppapi::PluginInstance* instance) { | 1677 webkit::ppapi::PluginInstance* instance) { |
| 1679 LockTargetMap::iterator it = mouse_lock_instances_.find(instance); | 1678 LockTargetMap::iterator it = mouse_lock_instances_.find(instance); |
| 1680 if (it != mouse_lock_instances_.end()) { | 1679 if (it != mouse_lock_instances_.end()) { |
| 1681 MouseLockDispatcher::LockTarget* target = it->second; | 1680 MouseLockDispatcher::LockTarget* target = it->second; |
| 1682 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target); | 1681 GetMouseLockDispatcher(instance)->OnLockTargetDestroyed(target); |
| 1683 delete target; | 1682 delete target; |
| 1684 mouse_lock_instances_.erase(it); | 1683 mouse_lock_instances_.erase(it); |
| 1685 } | 1684 } |
| 1686 } | 1685 } |
| 1687 | 1686 |
| 1687 MouseLockDispatcher* PepperPluginDelegateImpl::GetMouseLockDispatcher( |
| 1688 webkit::ppapi::PluginInstance* instance) { |
| 1689 if (instance->flash_fullscreen()) |
| 1690 return instance->fullscreen_container()->GetMouseLockDispatcher(); |
| 1691 else |
| 1692 return render_view_->mouse_lock_dispatcher(); |
| 1693 } |
| 1694 |
| 1688 webkit_glue::ClipboardClient* | 1695 webkit_glue::ClipboardClient* |
| 1689 PepperPluginDelegateImpl::CreateClipboardClient() const { | 1696 PepperPluginDelegateImpl::CreateClipboardClient() const { |
| 1690 return new RendererClipboardClient; | 1697 return new RendererClipboardClient; |
| 1691 } | 1698 } |
| 1692 | 1699 |
| 1693 } // namespace content | 1700 } // namespace content |
| OLD | NEW |