| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 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_CHANGE_OBSERVER_CHROMEOS_H_ | |
| 6 #define ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "ash/ash_export.h" | |
| 14 #include "base/macros.h" | |
| 15 #include "ui/display/chromeos/display_configurator.h" | |
| 16 #include "ui/display/manager/display_string_provider.h" | |
| 17 #include "ui/display/manager/managed_display_info.h" | |
| 18 #include "ui/events/devices/input_device_event_observer.h" | |
| 19 | |
| 20 namespace display { | |
| 21 class DisplayManager; | |
| 22 } | |
| 23 | |
| 24 namespace ash { | |
| 25 | |
| 26 class DisplaySnapshot; | |
| 27 | |
| 28 // An object that observes changes in display configuration and updates | |
| 29 // DisplayManager. | |
| 30 class DisplayChangeObserver : public ui::DisplayConfigurator::StateController, | |
| 31 public ui::DisplayConfigurator::Observer, | |
| 32 public ui::InputDeviceEventObserver { | |
| 33 public: | |
| 34 // Returns the mode list for internal display. | |
| 35 ASH_EXPORT static display::ManagedDisplayInfo::ManagedDisplayModeList | |
| 36 GetInternalManagedDisplayModeList( | |
| 37 const display::ManagedDisplayInfo& display_info, | |
| 38 const ui::DisplaySnapshot& output); | |
| 39 | |
| 40 // Returns the resolution list. | |
| 41 ASH_EXPORT static display::ManagedDisplayInfo::ManagedDisplayModeList | |
| 42 GetExternalManagedDisplayModeList(const ui::DisplaySnapshot& output); | |
| 43 | |
| 44 explicit DisplayChangeObserver( | |
| 45 std::unique_ptr<display::DisplayStringProvider> string_provider); | |
| 46 ~DisplayChangeObserver() override; | |
| 47 | |
| 48 void set_display_manager(display::DisplayManager* display_manager) { | |
| 49 display_manager_ = display_manager; | |
| 50 } | |
| 51 | |
| 52 void set_display_configurator(ui::DisplayConfigurator* display_configurator) { | |
| 53 display_configurator_ = display_configurator; | |
| 54 } | |
| 55 | |
| 56 // ui::DisplayConfigurator::StateController overrides: | |
| 57 ui::MultipleDisplayState GetStateForDisplayIds( | |
| 58 const ui::DisplayConfigurator::DisplayStateList& outputs) const override; | |
| 59 bool GetResolutionForDisplayId(int64_t display_id, | |
| 60 gfx::Size* size) const override; | |
| 61 | |
| 62 // Overriden from ui::DisplayConfigurator::Observer: | |
| 63 void OnDisplayModeChanged( | |
| 64 const ui::DisplayConfigurator::DisplayStateList& outputs) override; | |
| 65 void OnDisplayModeChangeFailed( | |
| 66 const ui::DisplayConfigurator::DisplayStateList& displays, | |
| 67 ui::MultipleDisplayState failed_new_state) override; | |
| 68 | |
| 69 // Overriden from ui::InputDeviceEventObserver: | |
| 70 void OnTouchscreenDeviceConfigurationChanged() override; | |
| 71 | |
| 72 // Exposed for testing. | |
| 73 ASH_EXPORT static float FindDeviceScaleFactor(float dpi); | |
| 74 | |
| 75 private: | |
| 76 std::unique_ptr<display::DisplayStringProvider> string_provider_; | |
| 77 display::DisplayManager* display_manager_ = nullptr; | |
| 78 ui::DisplayConfigurator* display_configurator_ = nullptr; | |
| 79 | |
| 80 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver); | |
| 81 }; | |
| 82 | |
| 83 } // namespace ash | |
| 84 | |
| 85 #endif // ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_ | |
| OLD | NEW |