OLD | NEW |
---|---|
(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 ash { | |
21 | |
22 namespace test { | |
23 class ShellTestApi; | |
24 } // namespace test | |
25 | |
26 class DisplayAnimator; | |
27 class DisplayManager; | |
28 struct DisplayLayout; | |
29 | |
30 class ASH_EXPORT DisplayConfigurationController | |
31 : public WindowTreeHostManager::Observer { | |
32 public: | |
33 DisplayConfigurationController( | |
34 DisplayManager* display_manager, | |
35 WindowTreeHostManager* window_tree_host_manager); | |
36 ~DisplayConfigurationController() override; | |
37 | |
38 // Sets the layout for |display_id| with a fade in/out animation. Currently | |
39 // |display_id| is assumed to be the secondary display. | |
40 // TODO(oshima/stevenjb): Support 3+ displays. | |
41 void SetDisplayLayout(int64_t display_id, | |
42 const DisplayLayout& layout, | |
43 bool user_action); | |
44 | |
45 // Sets the mirror mode with a fade-in/fade-out animation. Affects all | |
46 // displays. | |
47 void SetMirrorMode(bool mirror, bool user_action); | |
48 | |
49 // Sets the display's rotation with animation if available. | |
50 void SetDisplayRotation(int64_t display_id, | |
51 gfx::Display::Rotation rotation, | |
52 gfx::Display::RotationSource source, | |
53 bool user_action); | |
54 | |
55 // Sets the primary display id. | |
56 void SetPrimaryDisplayId(int64_t display_id, bool user_action); | |
57 | |
58 // WindowTreeHostManager::Observer | |
59 void OnDisplayConfigurationChanged() override; | |
oshima
2016/01/20 02:02:51
We probably should stop all animations if there is
stevenjb
2016/01/20 02:13:12
Done (in the C++ file).
| |
60 | |
61 protected: | |
62 friend class ash::test::ShellTestApi; | |
63 | |
64 // Allow tests to skip animations. | |
65 void ResetAnimatorForTest(); | |
66 | |
67 private: | |
68 class DisplayChangeLimiter; | |
69 | |
70 bool IsLimited(); | |
71 void SetDisplayLayoutImpl(int64_t display_id, const DisplayLayout& layout); | |
72 void SetMirrorModeImpl(bool mirror); | |
73 void SetPrimaryDisplayIdImpl(int64_t display_id); | |
74 | |
75 DisplayManager* display_manager_; // weak ptr | |
76 WindowTreeHostManager* window_tree_host_manager_; // weak ptr | |
77 scoped_ptr<DisplayAnimator> display_animator_; | |
78 scoped_ptr<DisplayChangeLimiter> limiter_; | |
79 | |
80 base::WeakPtrFactory<DisplayConfigurationController> weak_ptr_factory_; | |
81 | |
82 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationController); | |
83 }; | |
84 | |
85 } // namespace ash | |
86 | |
87 #endif // ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ | |
OLD | NEW |