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

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: addressing comments Created 4 years, 7 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 #include "public/platform/WebScheduler.h" 132 #include "public/platform/WebScheduler.h"
133 #include "public/platform/WebURLRequest.h" 133 #include "public/platform/WebURLRequest.h"
134 #include "public/platform/WebVector.h" 134 #include "public/platform/WebVector.h"
135 #include "public/platform/WebViewScheduler.h" 135 #include "public/platform/WebViewScheduler.h"
136 #include "public/web/WebAXObject.h" 136 #include "public/web/WebAXObject.h"
137 #include "public/web/WebActiveWheelFlingParameters.h" 137 #include "public/web/WebActiveWheelFlingParameters.h"
138 #include "public/web/WebAutofillClient.h" 138 #include "public/web/WebAutofillClient.h"
139 #include "public/web/WebElement.h" 139 #include "public/web/WebElement.h"
140 #include "public/web/WebFrame.h" 140 #include "public/web/WebFrame.h"
141 #include "public/web/WebFrameClient.h" 141 #include "public/web/WebFrameClient.h"
142 #include "public/web/WebFrameWidget.h"
142 #include "public/web/WebHitTestResult.h" 143 #include "public/web/WebHitTestResult.h"
143 #include "public/web/WebInputElement.h" 144 #include "public/web/WebInputElement.h"
144 #include "public/web/WebMeaningfulLayout.h" 145 #include "public/web/WebMeaningfulLayout.h"
145 #include "public/web/WebMediaPlayerAction.h" 146 #include "public/web/WebMediaPlayerAction.h"
146 #include "public/web/WebNode.h" 147 #include "public/web/WebNode.h"
147 #include "public/web/WebPlugin.h" 148 #include "public/web/WebPlugin.h"
148 #include "public/web/WebPluginAction.h" 149 #include "public/web/WebPluginAction.h"
149 #include "public/web/WebRange.h" 150 #include "public/web/WebRange.h"
150 #include "public/web/WebSelection.h" 151 #include "public/web/WebSelection.h"
151 #include "public/web/WebTextInputInfo.h" 152 #include "public/web/WebTextInputInfo.h"
(...skipping 4277 matching lines...) Expand 10 before | Expand all | Expand 10 after
4429 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState); 4430 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState);
4430 4431
4431 bool visible = visibilityState == WebPageVisibilityStateVisible; 4432 bool visible = visibilityState == WebPageVisibilityStateVisible;
4432 if (m_layerTreeView) 4433 if (m_layerTreeView)
4433 m_layerTreeView->setVisible(visible); 4434 m_layerTreeView->setVisible(visible);
4434 m_scheduler->setPageVisible(visible); 4435 m_scheduler->setPageVisible(visible);
4435 } 4436 }
4436 4437
4437 bool WebViewImpl::requestPointerLock() 4438 bool WebViewImpl::requestPointerLock()
4438 { 4439 {
4439 return m_client && m_client->requestPointerLock(); 4440 if (WebFrameWidget* widget = mainFrameImpl()->frameWidget()) {
4441 if (WebWidgetClient* client = widget->client())
4442 return client->requestPointerLock();
4443 }
4444
4445 return false;
4440 } 4446 }
4441 4447
4442 void WebViewImpl::requestPointerUnlock() 4448 void WebViewImpl::requestPointerUnlock()
4443 { 4449 {
4444 if (m_client) 4450 if (WebFrameWidget* widget = mainFrameImpl()->frameWidget()) {
4445 m_client->requestPointerUnlock(); 4451 if (WebWidgetClient* client = widget->client())
4452 client->requestPointerUnlock();
4453 }
4446 } 4454 }
4447 4455
4448 bool WebViewImpl::isPointerLocked() 4456 bool WebViewImpl::isPointerLocked()
4449 { 4457 {
4450 return m_client && m_client->isPointerLocked(); 4458 if (WebFrameWidget* widget = mainFrameImpl()->frameWidget()) {
4459 if (WebWidgetClient* client = widget->client())
4460 return client->isPointerLocked();
4461 }
4462
4463 return false;
4451 } 4464 }
4452 4465
4453 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) 4466 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event)
4454 { 4467 {
4455 OwnPtr<UserGestureIndicator> gestureIndicator; 4468 OwnPtr<UserGestureIndicator> gestureIndicator;
4456 AtomicString eventType; 4469 AtomicString eventType;
4457 switch (event.type) { 4470 switch (event.type) {
4458 case WebInputEvent::MouseDown: 4471 case WebInputEvent::MouseDown:
4459 eventType = EventTypeNames::mousedown; 4472 eventType = EventTypeNames::mousedown;
4460 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gNewUserGesture)); 4473 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gNewUserGesture));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
4534 { 4547 {
4535 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4548 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4536 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4549 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4537 if (!page()) 4550 if (!page())
4538 return 1; 4551 return 1;
4539 4552
4540 return page()->deviceScaleFactor(); 4553 return page()->deviceScaleFactor();
4541 } 4554 }
4542 4555
4543 } // namespace blink 4556 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698