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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 1980133002: Implement pointer lock API for out-of-process iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 #include "public/platform/WebScheduler.h" 133 #include "public/platform/WebScheduler.h"
134 #include "public/platform/WebURLRequest.h" 134 #include "public/platform/WebURLRequest.h"
135 #include "public/platform/WebVector.h" 135 #include "public/platform/WebVector.h"
136 #include "public/platform/WebViewScheduler.h" 136 #include "public/platform/WebViewScheduler.h"
137 #include "public/web/WebAXObject.h" 137 #include "public/web/WebAXObject.h"
138 #include "public/web/WebActiveWheelFlingParameters.h" 138 #include "public/web/WebActiveWheelFlingParameters.h"
139 #include "public/web/WebAutofillClient.h" 139 #include "public/web/WebAutofillClient.h"
140 #include "public/web/WebElement.h" 140 #include "public/web/WebElement.h"
141 #include "public/web/WebFrame.h" 141 #include "public/web/WebFrame.h"
142 #include "public/web/WebFrameClient.h" 142 #include "public/web/WebFrameClient.h"
143 #include "public/web/WebFrameWidget.h"
143 #include "public/web/WebHitTestResult.h" 144 #include "public/web/WebHitTestResult.h"
144 #include "public/web/WebInputElement.h" 145 #include "public/web/WebInputElement.h"
145 #include "public/web/WebMeaningfulLayout.h" 146 #include "public/web/WebMeaningfulLayout.h"
146 #include "public/web/WebMediaPlayerAction.h" 147 #include "public/web/WebMediaPlayerAction.h"
147 #include "public/web/WebNode.h" 148 #include "public/web/WebNode.h"
148 #include "public/web/WebPlugin.h" 149 #include "public/web/WebPlugin.h"
149 #include "public/web/WebPluginAction.h" 150 #include "public/web/WebPluginAction.h"
150 #include "public/web/WebRange.h" 151 #include "public/web/WebRange.h"
151 #include "public/web/WebScopedUserGesture.h" 152 #include "public/web/WebScopedUserGesture.h"
152 #include "public/web/WebSelection.h" 153 #include "public/web/WebSelection.h"
(...skipping 4285 matching lines...) Expand 10 before | Expand all | Expand 10 after
4438 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState); 4439 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState);
4439 4440
4440 bool visible = visibilityState == WebPageVisibilityStateVisible; 4441 bool visible = visibilityState == WebPageVisibilityStateVisible;
4441 if (m_layerTreeView) 4442 if (m_layerTreeView)
4442 m_layerTreeView->setVisible(visible); 4443 m_layerTreeView->setVisible(visible);
4443 m_scheduler->setPageVisible(visible); 4444 m_scheduler->setPageVisible(visible);
4444 } 4445 }
4445 4446
4446 bool WebViewImpl::requestPointerLock() 4447 bool WebViewImpl::requestPointerLock()
4447 { 4448 {
4448 return m_client && m_client->requestPointerLock(); 4449 if (WebFrameWidget* widget = mainFrameImpl()->frameWidget()) {
dcheng 2016/06/04 05:28:56 It doesn't seem like anyone still needs to call th
lfg 2016/06/06 20:09:43 Done.
4450 if (WebWidgetClient* client = widget->client())
4451 return client->requestPointerLock();
4452 }
4453
4454 return false;
4449 } 4455 }
4450 4456
4451 void WebViewImpl::requestPointerUnlock() 4457 void WebViewImpl::requestPointerUnlock()
4452 { 4458 {
4453 if (m_client) 4459 if (WebFrameWidget* widget = mainFrameImpl()->frameWidget()) {
4454 m_client->requestPointerUnlock(); 4460 if (WebWidgetClient* client = widget->client())
4461 client->requestPointerUnlock();
4462 }
4455 } 4463 }
4456 4464
4457 bool WebViewImpl::isPointerLocked() 4465 bool WebViewImpl::isPointerLocked()
4458 { 4466 {
4459 return m_client && m_client->isPointerLocked(); 4467 if (WebFrameWidget* widget = mainFrameImpl()->frameWidget()) {
4468 if (WebWidgetClient* client = widget->client())
4469 return client->isPointerLocked();
4470 }
4471
4472 return false;
4460 } 4473 }
4461 4474
4462 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) 4475 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event)
4463 { 4476 {
4464 OwnPtr<UserGestureIndicator> gestureIndicator; 4477 OwnPtr<UserGestureIndicator> gestureIndicator;
4465 AtomicString eventType; 4478 AtomicString eventType;
4466 switch (event.type) { 4479 switch (event.type) {
4467 case WebInputEvent::MouseDown: 4480 case WebInputEvent::MouseDown:
4468 eventType = EventTypeNames::mousedown; 4481 eventType = EventTypeNames::mousedown;
4469 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gNewUserGesture)); 4482 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gNewUserGesture));
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
4553 { 4566 {
4554 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4567 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4555 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4568 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4556 if (!page()) 4569 if (!page())
4557 return 1; 4570 return 1;
4558 4571
4559 return page()->deviceScaleFactor(); 4572 return page()->deviceScaleFactor();
4560 } 4573 }
4561 4574
4562 } // namespace blink 4575 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698