1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ASH_DISPLAY_DISPLAY_HIGHLIGHT_CONTROLLER_H_
6 #define ASH_DISPLAY_DISPLAY_HIGHLIGHT_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "ash/display/window_tree_host_manager.h"
10 #include "ash/public/cpp/session/session_observer.h"
11 #include "ui/views/widget/widget.h"
15 // DisplayHighlightController manages which display should render display
16 // identification highlights. Highlights are translucent blue rectangles on the
17 // edges of a display.
18 // TODO(1091497): Consider combining DisplayHighlightController and
19 // DisplayAlignmentController.
20 class ASH_EXPORT DisplayHighlightController
21 : public WindowTreeHostManager::Observer,
22 public SessionObserver {
24 DisplayHighlightController();
25 ~DisplayHighlightController() override;
27 // Sets the display to render the highlights on. To remove a currently-active
28 // highlight, pass display::kInvalidDisplayId as |display_id|.
29 void SetHighlightedDisplay(int64_t display_id);
31 views::Widget* GetWidgetForTesting() { return highlight_widget_.get(); }
34 // WindowTreeHostManager::Observer:
35 void OnDisplayConfigurationChanged() override;
36 void OnDisplaysInitialized() override;
39 void OnLockStateChanged(bool locked) override;
41 // Updates |highlight_| with new selected display.
42 void UpdateDisplayIdentificationHighlight();
44 // Widget used to render a blue highlight on the border of the specified
46 std::unique_ptr<views::Widget> highlight_widget_;
48 int64_t selected_display_id_ = display::kInvalidDisplayId;
50 // Tracks if the screen is locked in order to remove the highlight when screen
51 // locks and show it when it unlocks.
56 #endif // ASH_DISPLAY_DISPLAY_HIGHLIGHT_CONTROLLER_H_