Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 10824029: Queue Flash mouselock request if fullscreen is pending (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 if (!delay_report) { 1340 if (!delay_report) {
1341 ReportGeometry(); 1341 ReportGeometry();
1342 } else { 1342 } else {
1343 MessageLoop::current()->PostTask( 1343 MessageLoop::current()->PostTask(
1344 FROM_HERE, base::Bind(&PluginInstance::ReportGeometry, this)); 1344 FROM_HERE, base::Bind(&PluginInstance::ReportGeometry, this));
1345 } 1345 }
1346 } 1346 }
1347 } 1347 }
1348 1348
1349 void PluginInstance::UpdateFlashFullscreenState(bool flash_fullscreen) { 1349 void PluginInstance::UpdateFlashFullscreenState(bool flash_fullscreen) {
1350 if (flash_fullscreen == flash_fullscreen_) 1350 bool is_mouselock_pending = TrackedCallback::IsPending(lock_mouse_callback_);
1351
1352 if (flash_fullscreen == flash_fullscreen_) {
1353 // Manually clear callback when fullscreen fails with mouselock pending.
1354 if (!flash_fullscreen && is_mouselock_pending)
1355 TrackedCallback::ClearAndRun(&lock_mouse_callback_, PP_ERROR_FAILED);
1351 return; 1356 return;
1357 }
1352 1358
1353 bool old_plugin_focus = PluginHasFocus(); 1359 bool old_plugin_focus = PluginHasFocus();
1354 flash_fullscreen_ = flash_fullscreen; 1360 flash_fullscreen_ = flash_fullscreen;
1361 if (is_mouselock_pending && !delegate()->IsMouseLocked(this)) {
1362 if (!delegate()->LockMouse(this))
1363 TrackedCallback::ClearAndRun(&lock_mouse_callback_, PP_ERROR_FAILED);
1364 }
1365
1355 if (PluginHasFocus() != old_plugin_focus) 1366 if (PluginHasFocus() != old_plugin_focus)
1356 SendFocusChangeNotification(); 1367 SendFocusChangeNotification();
1357 } 1368 }
1358 1369
1359 int32_t PluginInstance::Navigate(PPB_URLRequestInfo_Impl* request, 1370 int32_t PluginInstance::Navigate(PPB_URLRequestInfo_Impl* request,
1360 const char* target, 1371 const char* target,
1361 bool from_user_action) { 1372 bool from_user_action) {
1362 if (!container_) 1373 if (!container_)
1363 return PP_ERROR_FAILED; 1374 return PP_ERROR_FAILED;
1364 1375
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 scoped_refptr<TrackedCallback> callback) { 1995 scoped_refptr<TrackedCallback> callback) {
1985 if (TrackedCallback::IsPending(lock_mouse_callback_)) 1996 if (TrackedCallback::IsPending(lock_mouse_callback_))
1986 return PP_ERROR_INPROGRESS; 1997 return PP_ERROR_INPROGRESS;
1987 1998
1988 if (delegate()->IsMouseLocked(this)) 1999 if (delegate()->IsMouseLocked(this))
1989 return PP_OK; 2000 return PP_OK;
1990 2001
1991 if (!CanAccessMainFrame()) 2002 if (!CanAccessMainFrame())
1992 return PP_ERROR_NOACCESS; 2003 return PP_ERROR_NOACCESS;
1993 2004
1994 if (delegate()->LockMouse(this)) { 2005 // Attempt mouselock only if Flash isn't waiting on fullscreen, otherwise
1995 lock_mouse_callback_ = callback; 2006 // we wait and call LockMouse() in UpdateFlashFullscreenState().
1996 return PP_OK_COMPLETIONPENDING; 2007 if (!FlashIsFullscreenOrPending() || flash_fullscreen()) {
1997 } else { 2008 if (!delegate()->LockMouse(this))
1998 return PP_ERROR_FAILED; 2009 return PP_ERROR_FAILED;
1999 } 2010 }
2011
2012 // Either mouselock succeeded or a Flash fullscreen is pending.
2013 lock_mouse_callback_ = callback;
2014 return PP_OK_COMPLETIONPENDING;
2000 } 2015 }
2001 2016
2002 void PluginInstance::UnlockMouse(PP_Instance instance) { 2017 void PluginInstance::UnlockMouse(PP_Instance instance) {
2003 delegate()->UnlockMouse(this); 2018 delegate()->UnlockMouse(this);
2004 } 2019 }
2005 2020
2006 PP_Bool PluginInstance::GetDefaultPrintSettings( 2021 PP_Bool PluginInstance::GetDefaultPrintSettings(
2007 PP_Instance instance, 2022 PP_Instance instance,
2008 PP_PrintSettings_Dev* print_settings) { 2023 PP_PrintSettings_Dev* print_settings) {
2009 // TODO(raymes): Not implemented for in-process. 2024 // TODO(raymes): Not implemented for in-process.
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2224 screen_size_for_fullscreen_ = gfx::Size(); 2239 screen_size_for_fullscreen_ = gfx::Size();
2225 WebElement element = container_->element(); 2240 WebElement element = container_->element();
2226 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2241 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2227 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2242 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2228 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2243 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2229 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2244 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2230 } 2245 }
2231 2246
2232 } // namespace ppapi 2247 } // namespace ppapi
2233 } // namespace webkit 2248 } // namespace webkit
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698