Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Side by Side Diff: ash/display/display_configuration_controller.h

Issue 1594683002: Introduce DisplayConfigurationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_576375_display1b1
Patch Set: Rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_
6 #define ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_
7
8 // This class controls Display related configuration. Specifically it:
9 // * Handles animated transitions where appropriate.
10 // * Limits the frequency of certain operations.
11 // * Provides a single interface for UI and API classes.
12 // * TODO: Forwards display configuration changed events to UI and API classes.
13
14 #include "ash/ash_export.h"
15 #include "ash/display/window_tree_host_manager.h"
16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h"
18 #include "ui/gfx/display.h"
19
20 namespace ui {
21 class DisplayConfigurator;
22 } // namespace ui
23
24 namespace ash {
25
26 namespace test {
27 class ShellTestApi;
28 } // namespace test
29
30 class DisplayManager;
31 class DisplayAnimator;
32 struct DisplayLayout;
33
34 class ASH_EXPORT DisplayConfigurationController
35 : public WindowTreeHostManager::Observer {
36 public:
37 DisplayConfigurationController(
38 ui::DisplayConfigurator* display_configurator_,
39 DisplayManager* display_manager,
40 WindowTreeHostManager* window_tree_host_manager);
41 ~DisplayConfigurationController() override;
42
43 // Sets the layout for |display_id| relative to |layout.primary_id| with
44 // a fade in/out animation. Currently |layout.primary_id| must be the primary
oshima 2016/01/19 18:49:16 I'm planning to extend DisplayLayout to support mo
stevenjb 2016/01/19 20:32:04 Simplified the comment for now, we can update it w
45 // display. TODO(oshima/stevenjb): Support 3+ displays.
46 void SetDisplayLayout(int64_t display_id,
47 const DisplayLayout& layout,
48 bool user_action);
49
50 // Sets the mirror mode with a fade-in/fade-out animation. Affects all
51 // displays.
52 void SetMirrorMode(bool mirror, bool user_action);
53
54 // Sets the display's rotation with animation if available.
55 void SetDisplayRotation(int64_t display_id,
56 gfx::Display::Rotation rotation,
57 gfx::Display::RotationSource source,
58 bool user_action);
59
60 // Sets the primary display id.
61 void SetPrimaryDisplayId(int64_t display_id, bool user_action);
62
63 // WindowTreeHostManager::Observer
64 void OnDisplayConfigurationChanged() override;
65
66 protected:
67 friend class ash::test::ShellTestApi;
68
69 // Allow tests to skip animations.
70 void ResetAnimatorForTest();
71
72 private:
73 class DisplayChangeLimiter;
74
75 bool IsLimited();
76 void SetLayoutImpl(int64_t display_id, const DisplayLayout& layout);
77 void SetMirrorModeImpl(bool mirror);
78 void SetPrimaryDisplayIdImpl(int64_t display_id);
79
80 ui::DisplayConfigurator* display_configurator_; // weak_ptr
81 DisplayManager* display_manager_; // weak ptr
82 WindowTreeHostManager* window_tree_host_manager_; // weak ptr
83 scoped_ptr<DisplayAnimator> display_animator_;
84 scoped_ptr<DisplayChangeLimiter> limiter_;
85
86 base::WeakPtrFactory<DisplayConfigurationController> weak_ptr_factory_;
87
88 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationController);
89 };
90
91 } // namespace ash
92
93 #endif // ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698