Chromium Code Reviews| 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 |
|
oshima
2016/04/08 07:09:40
include ?
| |
| 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. |
|
oshima
2016/04/08 07:09:40
This should be moved to 32 but I'll take care of i
| |
| 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 { | 20 namespace display { |
| 21 class DisplayLayout; | 21 class DisplayLayout; |
| 22 } | 22 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 34 : public WindowTreeHostManager::Observer { | 34 : public WindowTreeHostManager::Observer { |
| 35 public: | 35 public: |
| 36 DisplayConfigurationController( | 36 DisplayConfigurationController( |
| 37 DisplayManager* display_manager, | 37 DisplayManager* display_manager, |
| 38 WindowTreeHostManager* window_tree_host_manager); | 38 WindowTreeHostManager* window_tree_host_manager); |
| 39 ~DisplayConfigurationController() override; | 39 ~DisplayConfigurationController() override; |
| 40 | 40 |
| 41 // 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 |
| 42 // animation. Currently |display_id| is assumed to be the secondary | 42 // animation. Currently |display_id| is assumed to be the secondary |
| 43 // display. TODO(oshima/stevenjb): Support 3+ displays. | 43 // display. TODO(oshima/stevenjb): Support 3+ displays. |
| 44 void SetDisplayLayout(scoped_ptr<display::DisplayLayout> layout, | 44 void SetDisplayLayout(std::unique_ptr<display::DisplayLayout> layout, |
| 45 bool user_action); | 45 bool user_action); |
| 46 | 46 |
| 47 // 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 |
| 48 // displays. | 48 // displays. |
| 49 void SetMirrorMode(bool mirror, bool user_action); | 49 void SetMirrorMode(bool mirror, bool user_action); |
| 50 | 50 |
| 51 // Sets the display's rotation with animation if available. | 51 // Sets the display's rotation with animation if available. |
| 52 void SetDisplayRotation(int64_t display_id, | 52 void SetDisplayRotation(int64_t display_id, |
| 53 gfx::Display::Rotation rotation, | 53 gfx::Display::Rotation rotation, |
| 54 gfx::Display::RotationSource source, | 54 gfx::Display::RotationSource source, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 66 // Allow tests to skip animations. | 66 // Allow tests to skip animations. |
| 67 void ResetAnimatorForTest(); | 67 void ResetAnimatorForTest(); |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 class DisplayChangeLimiter; | 70 class DisplayChangeLimiter; |
| 71 | 71 |
| 72 // Sets the timeout for the DisplayChangeLimiter if it exists. Call this | 72 // Sets the timeout for the DisplayChangeLimiter if it exists. Call this |
| 73 // *before* starting any animations. | 73 // *before* starting any animations. |
| 74 void SetThrottleTimeout(int64_t throttle_ms); | 74 void SetThrottleTimeout(int64_t throttle_ms); |
| 75 bool IsLimited(); | 75 bool IsLimited(); |
| 76 void SetDisplayLayoutImpl(scoped_ptr<display::DisplayLayout> layout); | 76 void SetDisplayLayoutImpl(std::unique_ptr<display::DisplayLayout> layout); |
| 77 void SetMirrorModeImpl(bool mirror); | 77 void SetMirrorModeImpl(bool mirror); |
| 78 void SetPrimaryDisplayIdImpl(int64_t display_id); | 78 void SetPrimaryDisplayIdImpl(int64_t display_id); |
| 79 | 79 |
| 80 DisplayManager* display_manager_; // weak ptr | 80 DisplayManager* display_manager_; // weak ptr |
| 81 WindowTreeHostManager* window_tree_host_manager_; // weak ptr | 81 WindowTreeHostManager* window_tree_host_manager_; // weak ptr |
| 82 scoped_ptr<DisplayAnimator> display_animator_; | 82 std::unique_ptr<DisplayAnimator> display_animator_; |
| 83 scoped_ptr<DisplayChangeLimiter> limiter_; | 83 std::unique_ptr<DisplayChangeLimiter> limiter_; |
| 84 | 84 |
| 85 base::WeakPtrFactory<DisplayConfigurationController> weak_ptr_factory_; | 85 base::WeakPtrFactory<DisplayConfigurationController> weak_ptr_factory_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationController); | 87 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationController); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace ash | 90 } // namespace ash |
| 91 | 91 |
| 92 #endif // ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ | 92 #endif // ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ |
| OLD | NEW |