[M73 Merge][Locked Fullscreen] Fix URL click tablet mode bug

Clicking on a link inside of locked fullscreen mode while in tablet mode
turns immersive fullscreen on which is unwanted since the immersive mode
shows exit UI - we don't want to allow the user to exit the locked
fullscreen mode.  Fix this by not enabling immersive in this situation.

TBR=isandrk@chromium.org

(cherry picked from commit 893b3b1b46bf35179d7a011585ace00bc457844a)

Bug: 888684
Change-Id: Id9000e459c9b59b81d15ea5eb1d4a236e1132172
Reviewed-on: https://chromium-review.googlesource.com/c/1439080
Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org>
Commit-Queue: Ivan Šandrk <isandrk@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#627051}
Reviewed-on: https://chromium-review.googlesource.com/c/1447691
Reviewed-by: Ivan Šandrk <isandrk@chromium.org>
Cr-Commit-Position: refs/branch-heads/3683@{#87}
Cr-Branched-From: e51029943e0a38dd794b73caaf6373d5496ae783-refs/heads/master@{#625896}
diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc
index 368ee50..afc0730 100644
--- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc
+++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h"
 
 #include "ash/public/cpp/immersive/immersive_revealed_lock.h"
+#include "ash/public/cpp/window_pin_type.h"
 #include "ash/public/cpp/window_properties.h"
 #include "ash/public/cpp/window_state_type.h"
 #include "ash/public/interfaces/window_state_type.mojom.h"
@@ -195,6 +196,11 @@
   if (!TabletModeClient::Get()->tablet_mode_enabled())
     return;
 
+  // Don't use immersive mode as long as we are in the locked fullscreen mode
+  // since immersive shows browser controls which allow exiting the mode.
+  if (ash::IsWindowTrustedPinned(widget->GetNativeWindow()))
+    return;
+
   // Enable immersive mode if the widget is activated. Do not disable immersive
   // mode if the widget deactivates, but is not minimized.
   ash::ImmersiveFullscreenController::EnableForWidget(