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
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51

ash / wm / overview / overview_focus_cycler.h [blame]

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WM_OVERVIEW_OVERVIEW_FOCUS_CYCLER_H_
#define ASH_WM_OVERVIEW_OVERVIEW_FOCUS_CYCLER_H_

#include <vector>

#include "ash/ash_export.h"
#include "base/memory/raw_ptr.h"

namespace views {
class Widget;
class View;
}  // namespace views

namespace ash {
class OverviewSession;

class ASH_EXPORT OverviewFocusCycler {
 public:
  explicit OverviewFocusCycler(OverviewSession* overview_session);
  OverviewFocusCycler(const OverviewFocusCycler&) = delete;
  OverviewFocusCycler& operator=(const OverviewFocusCycler&) = delete;
  ~OverviewFocusCycler();

  // Moves the focus ring to the next traversable view. Rotates focus to the
  // next traversable widget if necessary.
  void MoveFocus(bool reverse);

  bool AcceptSelection();

  // Returns the current overview UI focused view if there is one.
  views::View* GetOverviewFocusedView();

  void UpdateAccessibilityFocus();

 private:
  // Gets the list of traversable widgets in overview.
  std::vector<views::Widget*> GetTraversableWidgets(
      bool for_accessibility) const;

  // The overview session which owns this object. Guaranteed to be non-null for
  // the lifetime of `this`.
  const raw_ptr<OverviewSession> overview_session_;
};

}  // namespace ash

#endif  // ASH_WM_OVERVIEW_OVERVIEW_FOCUS_CYCLER_H_