| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ |
| 6 #define ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ | 6 #define ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ |
| 7 | 7 |
| 8 // This class controls Display related configuration. Specifically it: | 8 // This class controls Display related configuration. Specifically it: |
| 9 // * Handles animated transitions where appropriate. | 9 // * Handles animated transitions where appropriate. |
| 10 // * Limits the frequency of certain operations. | 10 // * Limits the frequency of certain operations. |
| 11 // * Provides a single interface for UI and API classes. | 11 // * Provides a single interface for UI and API classes. |
| 12 // * TODO: Forwards display configuration changed events to UI and API classes. | 12 // * TODO: Forwards display configuration changed events to UI and API classes. |
| 13 | 13 |
| 14 #include "ash/ash_export.h" | 14 #include "ash/ash_export.h" |
| 15 #include "ash/display/window_tree_host_manager.h" | 15 #include "ash/display/window_tree_host_manager.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
| 19 | 19 |
| 20 namespace display { |
| 21 class DisplayLayout; |
| 22 } |
| 23 |
| 20 namespace ash { | 24 namespace ash { |
| 21 | 25 |
| 22 namespace test { | 26 namespace test { |
| 23 class ShellTestApi; | 27 class ShellTestApi; |
| 24 } // namespace test | 28 } // namespace test |
| 25 | 29 |
| 26 class DisplayAnimator; | 30 class DisplayAnimator; |
| 27 class DisplayManager; | 31 class DisplayManager; |
| 28 class DisplayLayout; | |
| 29 | 32 |
| 30 class ASH_EXPORT DisplayConfigurationController | 33 class ASH_EXPORT DisplayConfigurationController |
| 31 : public WindowTreeHostManager::Observer { | 34 : public WindowTreeHostManager::Observer { |
| 32 public: | 35 public: |
| 33 DisplayConfigurationController( | 36 DisplayConfigurationController( |
| 34 DisplayManager* display_manager, | 37 DisplayManager* display_manager, |
| 35 WindowTreeHostManager* window_tree_host_manager); | 38 WindowTreeHostManager* window_tree_host_manager); |
| 36 ~DisplayConfigurationController() override; | 39 ~DisplayConfigurationController() override; |
| 37 | 40 |
| 38 // Sets the layout for the current displays with a fade in/out | 41 // Sets the layout for the current displays with a fade in/out |
| 39 // animation. Currently |display_id| is assumed to be the secondary | 42 // animation. Currently |display_id| is assumed to be the secondary |
| 40 // display. TODO(oshima/stevenjb): Support 3+ displays. | 43 // display. TODO(oshima/stevenjb): Support 3+ displays. |
| 41 void SetDisplayLayout(scoped_ptr<DisplayLayout> layout, bool user_action); | 44 void SetDisplayLayout(scoped_ptr<display::DisplayLayout> layout, |
| 45 bool user_action); |
| 42 | 46 |
| 43 // Sets the mirror mode with a fade-in/fade-out animation. Affects all | 47 // Sets the mirror mode with a fade-in/fade-out animation. Affects all |
| 44 // displays. | 48 // displays. |
| 45 void SetMirrorMode(bool mirror, bool user_action); | 49 void SetMirrorMode(bool mirror, bool user_action); |
| 46 | 50 |
| 47 // Sets the display's rotation with animation if available. | 51 // Sets the display's rotation with animation if available. |
| 48 void SetDisplayRotation(int64_t display_id, | 52 void SetDisplayRotation(int64_t display_id, |
| 49 gfx::Display::Rotation rotation, | 53 gfx::Display::Rotation rotation, |
| 50 gfx::Display::RotationSource source, | 54 gfx::Display::RotationSource source, |
| 51 bool user_action); | 55 bool user_action); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 62 // Allow tests to skip animations. | 66 // Allow tests to skip animations. |
| 63 void ResetAnimatorForTest(); | 67 void ResetAnimatorForTest(); |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 class DisplayChangeLimiter; | 70 class DisplayChangeLimiter; |
| 67 | 71 |
| 68 // Sets the timeout for the DisplayChangeLimiter if it exists. Call this | 72 // Sets the timeout for the DisplayChangeLimiter if it exists. Call this |
| 69 // *before* starting any animations. | 73 // *before* starting any animations. |
| 70 void SetThrottleTimeout(int64_t throttle_ms); | 74 void SetThrottleTimeout(int64_t throttle_ms); |
| 71 bool IsLimited(); | 75 bool IsLimited(); |
| 72 void SetDisplayLayoutImpl(scoped_ptr<DisplayLayout> layout); | 76 void SetDisplayLayoutImpl(scoped_ptr<display::DisplayLayout> layout); |
| 73 void SetMirrorModeImpl(bool mirror); | 77 void SetMirrorModeImpl(bool mirror); |
| 74 void SetPrimaryDisplayIdImpl(int64_t display_id); | 78 void SetPrimaryDisplayIdImpl(int64_t display_id); |
| 75 | 79 |
| 76 DisplayManager* display_manager_; // weak ptr | 80 DisplayManager* display_manager_; // weak ptr |
| 77 WindowTreeHostManager* window_tree_host_manager_; // weak ptr | 81 WindowTreeHostManager* window_tree_host_manager_; // weak ptr |
| 78 scoped_ptr<DisplayAnimator> display_animator_; | 82 scoped_ptr<DisplayAnimator> display_animator_; |
| 79 scoped_ptr<DisplayChangeLimiter> limiter_; | 83 scoped_ptr<DisplayChangeLimiter> limiter_; |
| 80 | 84 |
| 81 base::WeakPtrFactory<DisplayConfigurationController> weak_ptr_factory_; | 85 base::WeakPtrFactory<DisplayConfigurationController> weak_ptr_factory_; |
| 82 | 86 |
| 83 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationController); | 87 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationController); |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 } // namespace ash | 90 } // namespace ash |
| 87 | 91 |
| 88 #endif // ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ | 92 #endif // ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ |
| OLD | NEW |