blob: aeeabd86691e3959ce81616529c4c6d5389e7b63 [file] [log] [blame]
Avi Drissman8ba1bad2022-09-13 19:22:361// Copyright 2019 The Chromium Authors
Mikolaj Walczak297ece62019-10-11 02:55:402// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_EXO_CLIENT_CONTROLLED_ACCELERATORS_H_
6#define COMPONENTS_EXO_CLIENT_CONTROLLED_ACCELERATORS_H_
7
Arthur Sonzogniae0e89172023-04-22 11:15:358#include "base/memory/raw_ptr.h"
Mikolaj Walczak297ece62019-10-11 02:55:409#include "components/exo/client_controlled_shell_surface.h"
10#include "ui/aura/window.h"
11#include "ui/base/accelerators/accelerator.h"
12#include "ui/views/focus/focus_manager.h"
13
14namespace exo {
15
16enum class ClientControlledAcceleratorAction {
17 ZOOM_IN,
18 ZOOM_OUT,
19 ZOOM_RESET,
20};
21
22class ClientControlledShellSurface;
23
24class ClientControlledAcceleratorTarget : public ui::AcceleratorTarget {
25 public:
26 explicit ClientControlledAcceleratorTarget(
27 ClientControlledShellSurface* surface);
Peter Boström09c01822021-09-20 22:43:2728
29 ClientControlledAcceleratorTarget(const ClientControlledAcceleratorTarget&) =
30 delete;
31 ClientControlledAcceleratorTarget& operator=(
32 const ClientControlledAcceleratorTarget&) = delete;
33
Mikolaj Walczak297ece62019-10-11 02:55:4034 ~ClientControlledAcceleratorTarget() override;
35
36 void RegisterAccelerator(const ui::Accelerator& accelerator,
37 ClientControlledAcceleratorAction action);
38 void RegisterAccelerator(ui::Accelerator&& accelerator,
39 ClientControlledAcceleratorAction action);
40
41 // ui::AcceleratorTarget interface implementation.
42 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
43 bool CanHandleAccelerators() const override;
44
45 private:
Bartek Nowierski5ecc98a2023-12-22 09:26:0246 raw_ptr<ClientControlledShellSurface> surface_;
Mikolaj Walczak297ece62019-10-11 02:55:4047 std::map<ui::Accelerator, ClientControlledAcceleratorAction> accelerators_;
Mikolaj Walczak297ece62019-10-11 02:55:4048};
49
50} // namespace exo
51
52#endif // COMPONENTS_EXO_CLIENT_CONTROLLED_ACCELERATORS_H_