1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_XR_RUNTIME_H_ 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_XR_RUNTIME_H_ 7 8 #include "base/observer_list_types.h" 9 #include "content/common/content_export.h" 10 #include "device/vr/public/mojom/vr_service.mojom-forward.h" 11 12 namespace content { 13 class WebContents; 14 } 15 16 namespace content { 17 // This interface allows observing the state of the XR service for a particular 18 // runtime. In particular, observers may currently know when the browser 19 // considers a WebContents presenting to an immersive headset. Implementers of 20 // this interface will be called on the main browser thread. Currently this is 21 // used on Windows to drive overlays. 22 class CONTENT_EXPORT BrowserXRRuntime { 23 public: 24 class Observer : public base::CheckedObserver { 25 public: SetVRDisplayInfo(device::mojom::VRDisplayInfoPtr display_info)26 virtual void SetVRDisplayInfo( 27 device::mojom::VRDisplayInfoPtr display_info) {} 28 29 // The parameter |contents| is set when a page starts an immersive WebXR 30 // session. There can only be at most one active immersive session for the 31 // XRRuntime. Set to null when there is no active immersive session. SetWebXRWebContents(content::WebContents * contents)32 virtual void SetWebXRWebContents(content::WebContents* contents) {} 33 SetFramesThrottled(bool throttled)34 virtual void SetFramesThrottled(bool throttled) {} 35 }; 36 37 virtual void AddObserver(Observer* observer) = 0; 38 virtual void RemoveObserver(Observer* observer) = 0; 39 virtual void SetInlinePosesEnabled(bool enabled) = 0; 40 }; 41 42 } // namespace content 43 44 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_XR_RUNTIME_H_ 45