blob: f1156983d2b757c38daae24f1a6d469a12715314 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ANDROID_VR_ARCORE_DEVICE_ARCORE_INSTALL_UTILS_H_
#define CHROME_BROWSER_ANDROID_VR_ARCORE_DEVICE_ARCORE_INSTALL_UTILS_H_
#include "base/android/scoped_java_ref.h"
#include "base/memory/weak_ptr.h"
#include "ui/display/display.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_widget_types.h"
namespace vr {
// Immersive AR sessions use callbacks in the following sequence:
//
// RequestArSession
// SurfaceReadyCallback
// SurfaceTouchCallback (repeated for each touch)
// [exit session via "back" button, or via JS session exit]
// DestroyedCallback
//
using SurfaceReadyCallback =
base::RepeatingCallback<void(gfx::AcceleratedWidget window,
display::Display::Rotation rotation,
const gfx::Size& size)>;
using SurfaceTouchCallback =
base::RepeatingCallback<void(bool touching, const gfx::PointF& location)>;
using SurfaceDestroyedCallback = base::OnceClosure;
class ArCoreInstallUtils {
public:
virtual ~ArCoreInstallUtils() = default;
// Returns true if AR module installation is supported, false otherwise.
virtual bool CanRequestInstallArModule() = 0;
// Returns true if AR module is not installed, false otherwise.
virtual bool ShouldRequestInstallArModule() = 0;
virtual void RequestInstallArModule(int render_process_id,
int render_frame_id) = 0;
virtual bool ShouldRequestInstallSupportedArCore() = 0;
virtual void RequestInstallSupportedArCore(int render_process_id,
int render_frame_id) = 0;
virtual bool EnsureLoaded() = 0;
virtual base::android::ScopedJavaLocalRef<jobject>
GetApplicationContext() = 0;
virtual void RequestArSession(
int render_process_id,
int render_frame_id,
SurfaceReadyCallback ready_callback,
SurfaceTouchCallback touch_callback,
SurfaceDestroyedCallback destroyed_callback) = 0;
virtual void DestroyDrawingSurface() = 0;
};
} // namespace vr
#endif // CHROME_BROWSER_ANDROID_VR_ARCORE_DEVICE_ARCORE_INSTALL_UTILS_H_