fix_patch_out_permissions_checks_in_exclusive_access.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Shelley Vohr <[email protected]>
  3. Date: Mon, 25 Oct 2021 21:45:57 +0200
  4. Subject: fix: patch out permissions checks in exclusive_access
  5. This patch is necessary in order to properly enable
  6. navigator.keyboard.{(un)?lock}() functionality. We don't have a concept
  7. of PermissionManager nor of a Profile, so this would not affect usage of
  8. the API.
  9. We might consider potentially using our own permissions handler,
  10. but it's not strictly necessary for this API to work to spec.
  11. Profile check has been upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/3247196
  12. diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
  13. index 9b2c91d39324b61afa49ccea6be2eda8308473ff..1652b52c5c752809348b3ab44d3703ac343c829d 100644
  14. --- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
  15. +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
  16. @@ -382,13 +382,9 @@ void FullscreenController::EnterFullscreenModeInternal(
  17. // Do not enter fullscreen mode if disallowed by pref. This prevents the user
  18. // from manually entering fullscreen mode and also disables kiosk mode on
  19. // desktop platforms.
  20. - if (!exclusive_access_manager()
  21. - ->context()
  22. - ->GetProfile()
  23. - ->GetPrefs()
  24. - ->GetBoolean(prefs::kFullscreenAllowed)) {
  25. + auto* profile = exclusive_access_manager()->context()->GetProfile();
  26. + if (!profile || !profile->GetPrefs()->GetBoolean(prefs::kFullscreenAllowed))
  27. return;
  28. - }
  29. #endif
  30. toggled_into_fullscreen_ = true;
  31. @@ -401,6 +397,7 @@ void FullscreenController::EnterFullscreenModeInternal(
  32. url = extension_caused_fullscreen_;
  33. }
  34. +#if 0
  35. if (display_id != display::kInvalidDisplayId) {
  36. // Check, but do not prompt, for permission to request a specific screen.
  37. // Sites generally need permission to get the display id in the first place.
  38. @@ -413,6 +410,7 @@ void FullscreenController::EnterFullscreenModeInternal(
  39. display_id = display::kInvalidDisplayId;
  40. }
  41. }
  42. +#endif
  43. if (option == BROWSER)
  44. base::RecordAction(base::UserMetricsAction("ToggleFullscreen"));