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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 bool PluginInstance::IsProcessingUserGesture() { | 1626 bool PluginInstance::IsProcessingUserGesture() { |
1627 PP_TimeTicks now = | 1627 PP_TimeTicks now = |
1628 ::ppapi::TimeTicksToPPTimeTicks(base::TimeTicks::Now()); | 1628 ::ppapi::TimeTicksToPPTimeTicks(base::TimeTicks::Now()); |
1629 // Give a lot of slack so tests won't be flaky. Well behaved plugins will | 1629 // Give a lot of slack so tests won't be flaky. Well behaved plugins will |
1630 // close the user gesture. | 1630 // close the user gesture. |
1631 const PP_TimeTicks kUserGestureDurationInSeconds = 10.0; | 1631 const PP_TimeTicks kUserGestureDurationInSeconds = 10.0; |
1632 return (now - pending_user_gesture_ < kUserGestureDurationInSeconds); | 1632 return (now - pending_user_gesture_ < kUserGestureDurationInSeconds); |
1633 } | 1633 } |
1634 | 1634 |
1635 void PluginInstance::OnLockMouseACK(bool succeeded) { | 1635 void PluginInstance::OnLockMouseACK(bool succeeded) { |
1636 if (!TrackedCallback::IsPending(lock_mouse_callback_)) { | 1636 if (TrackedCallback::IsPending(lock_mouse_callback_)) { |
1637 NOTREACHED(); | 1637 TrackedCallback::ClearAndRun(&lock_mouse_callback_, |
1638 return; | 1638 succeeded ? PP_OK : PP_ERROR_FAILED); |
1639 } | 1639 } |
1640 TrackedCallback::ClearAndRun(&lock_mouse_callback_, | |
1641 succeeded ? PP_OK : PP_ERROR_FAILED); | |
1642 } | 1640 } |
1643 | 1641 |
1644 void PluginInstance::OnMouseLockLost() { | 1642 void PluginInstance::OnMouseLockLost() { |
1645 if (LoadMouseLockInterface()) | 1643 if (LoadMouseLockInterface()) |
1646 plugin_mouse_lock_interface_->MouseLockLost(pp_instance()); | 1644 plugin_mouse_lock_interface_->MouseLockLost(pp_instance()); |
1647 } | 1645 } |
1648 | 1646 |
1649 void PluginInstance::HandleMouseLockedInputEvent( | 1647 void PluginInstance::HandleMouseLockedInputEvent( |
1650 const WebKit::WebMouseEvent& event) { | 1648 const WebKit::WebMouseEvent& event) { |
1651 // |cursor_info| is ignored since it is hidden when the mouse is locked. | 1649 // |cursor_info| is ignored since it is hidden when the mouse is locked. |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2243 screen_size_for_fullscreen_ = gfx::Size(); | 2241 screen_size_for_fullscreen_ = gfx::Size(); |
2244 WebElement element = container_->element(); | 2242 WebElement element = container_->element(); |
2245 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2243 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2246 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2244 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2247 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2245 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2248 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2246 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2249 } | 2247 } |
2250 | 2248 |
2251 } // namespace ppapi | 2249 } // namespace ppapi |
2252 } // namespace webkit | 2250 } // namespace webkit |
OLD | NEW |