Chromium Code Reviews| Index: ash/display/display_configuration_controller.h |
| diff --git a/ash/display/display_configuration_controller.h b/ash/display/display_configuration_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4380afd83fd06d24865f63dc6a8cabddb34a307a |
| --- /dev/null |
| +++ b/ash/display/display_configuration_controller.h |
| @@ -0,0 +1,93 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ |
| +#define ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ |
| + |
| +// This class controls Display related configuration. Specifically it: |
| +// * Handles animated transitions where appropriate. |
| +// * Limits the frequency of certain operations. |
| +// * Provides a single interface for UI and API classes. |
| +// * TODO: Forwards display configuration changed events to UI and API classes. |
| + |
| +#include "ash/ash_export.h" |
| +#include "ash/display/window_tree_host_manager.h" |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "ui/gfx/display.h" |
| + |
| +namespace ui { |
| +class DisplayConfigurator; |
| +} // namespace ui |
| + |
| +namespace ash { |
| + |
| +namespace test { |
| +class ShellTestApi; |
| +} // namespace test |
| + |
| +class DisplayManager; |
| +class DisplayAnimator; |
| +struct DisplayLayout; |
| + |
| +class ASH_EXPORT DisplayConfigurationController |
| + : public WindowTreeHostManager::Observer { |
| + public: |
| + DisplayConfigurationController( |
| + ui::DisplayConfigurator* display_configurator_, |
| + DisplayManager* display_manager, |
| + WindowTreeHostManager* window_tree_host_manager); |
| + ~DisplayConfigurationController() override; |
| + |
| + // Sets the layout for |display_id| relative to |layout.primary_id| with |
| + // 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
|
| + // display. TODO(oshima/stevenjb): Support 3+ displays. |
| + void SetDisplayLayout(int64_t display_id, |
| + const DisplayLayout& layout, |
| + bool user_action); |
| + |
| + // Sets the mirror mode with a fade-in/fade-out animation. Affects all |
| + // displays. |
| + void SetMirrorMode(bool mirror, bool user_action); |
| + |
| + // Sets the display's rotation with animation if available. |
| + void SetDisplayRotation(int64_t display_id, |
| + gfx::Display::Rotation rotation, |
| + gfx::Display::RotationSource source, |
| + bool user_action); |
| + |
| + // Sets the primary display id. |
| + void SetPrimaryDisplayId(int64_t display_id, bool user_action); |
| + |
| + // WindowTreeHostManager::Observer |
| + void OnDisplayConfigurationChanged() override; |
| + |
| + protected: |
| + friend class ash::test::ShellTestApi; |
| + |
| + // Allow tests to skip animations. |
| + void ResetAnimatorForTest(); |
| + |
| + private: |
| + class DisplayChangeLimiter; |
| + |
| + bool IsLimited(); |
| + void SetLayoutImpl(int64_t display_id, const DisplayLayout& layout); |
| + void SetMirrorModeImpl(bool mirror); |
| + void SetPrimaryDisplayIdImpl(int64_t display_id); |
| + |
| + ui::DisplayConfigurator* display_configurator_; // weak_ptr |
| + DisplayManager* display_manager_; // weak ptr |
| + WindowTreeHostManager* window_tree_host_manager_; // weak ptr |
| + scoped_ptr<DisplayAnimator> display_animator_; |
| + scoped_ptr<DisplayChangeLimiter> limiter_; |
| + |
| + base::WeakPtrFactory<DisplayConfigurationController> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationController); |
| +}; |
| + |
| +} // namespace ash |
| + |
| +#endif // ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_ |