Use Promise with RequestPointerLock calls

https://chromium-review.googlesource.com/c/chromium/src/+/2069199
This commit is contained in:
John Kleinschmidt
2020-03-11 14:16:08 -04:00
parent 312f11129f
commit 34350db4bd
3 changed files with 12 additions and 5 deletions

View File

@@ -370,9 +370,9 @@ gfx::Size OffScreenRenderWidgetHostView::GetVisibleViewportSize() {
void OffScreenRenderWidgetHostView::SetInsets(const gfx::Insets& insets) {}
bool OffScreenRenderWidgetHostView::LockMouse(
blink::mojom::PointerLockResult OffScreenRenderWidgetHostView::LockMouse(
bool request_unadjusted_movement) {
return false;
return blink::mojom::PointerLockResult::kUnsupportedOptions;
}
void OffScreenRenderWidgetHostView::UnlockMouse() {}

View File

@@ -93,7 +93,8 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
void SetBackgroundColor(SkColor color) override;
base::Optional<SkColor> GetBackgroundColor() override;
void UpdateBackgroundColor() override;
bool LockMouse(bool request_unadjusted_movement) override;
blink::mojom::PointerLockResult LockMouse(
bool request_unadjusted_movement) override;
void UnlockMouse(void) override;
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
#if defined(OS_MACOSX)

View File

@@ -43,8 +43,14 @@ void MediaAccessAllowed(const content::MediaStreamRequest& request,
}
void OnPointerLockResponse(content::WebContents* web_contents, bool allowed) {
if (web_contents)
web_contents->GotResponseToLockMouseRequest(allowed);
if (web_contents) {
if (allowed)
web_contents->GotResponseToLockMouseRequest(
blink::mojom::PointerLockResult::kSuccess);
else
web_contents->GotResponseToLockMouseRequest(
blink::mojom::PointerLockResult::kRequiresUserGesture);
}
}
void OnPermissionResponse(base::OnceCallback<void(bool)> callback,