summaryrefslogtreecommitdiff
path: root/chromium/ui/ozone/platform/wayland/host/linux_ui_delegate_wayland.h
blob: beb0aecb69cd94052ad6e477f172bcb8d69d61f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2020 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 UI_OZONE_PLATFORM_WAYLAND_HOST_LINUX_UI_DELEGATE_WAYLAND_H_
#define UI_OZONE_PLATFORM_WAYLAND_HOST_LINUX_UI_DELEGATE_WAYLAND_H_

#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/linux/linux_ui_delegate.h"

namespace ui {

class WaylandConnection;

class LinuxUiDelegateWayland : public LinuxUiDelegate {
 public:
  explicit LinuxUiDelegateWayland(WaylandConnection* connection);
  ~LinuxUiDelegateWayland() override;

  // LinuxUiDelegate:
  LinuxUiBackend GetBackend() const override;
  bool ExportWindowHandle(
      gfx::AcceleratedWidget parent,
      base::OnceCallback<void(const std::string&)> callback) override;
  bool ExportWindowHandle(
      gfx::AcceleratedWidget window_id,
      base::OnceCallback<void(std::string)> callback) override;

 private:
  void OnHandleForward(base::OnceCallback<void(std::string)> callback,
                       const std::string& handle);

  const raw_ptr<WaylandConnection> connection_;
  base::WeakPtrFactory<LinuxUiDelegateWayland> weak_factory_{this};
};

}  // namespace ui

#endif  // UI_OZONE_PLATFORM_WAYLAND_HOST_LINUX_UI_DELEGATE_WAYLAND_H_