| 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/manager/chromeos/display_configurator.h" | |
| 16 #include "ui/display/manager/managed_display_info.h" | |
| 17 #include "ui/events/devices/input_device_event_observer.h" | |
| 18 | |
| 19 namespace display { | |
| 20 class DisplayManager; | |
| 21 } | |
| 22 | |
| 23 namespace ash { | |
| 24 | |
| 25 class DisplaySnapshot; | |
| 26 | |
| 27 // An object that observes changes in display configuration and updates | |
| 28 // DisplayManager. | |
| 29 class DisplayChangeObserver : public ui::DisplayConfigurator::StateController, | |
| 30 public ui::DisplayConfigurator::Observer, | |
| 31 public ui::InputDeviceEventObserver { | |
| 32 public: | |
| 33 // Returns the mode list for internal display. | |
| 34 ASH_EXPORT static display::ManagedDisplayInfo::ManagedDisplayModeList | |
| 35 GetInternalManagedDisplayModeList( | |
| 36 const display::ManagedDisplayInfo& display_info, | |
| 37 const ui::DisplaySnapshot& output); | |
| 38 | |
| 39 // Returns the resolution list. | |
| 40 ASH_EXPORT static display::ManagedDisplayInfo::ManagedDisplayModeList | |
| 41 GetExternalManagedDisplayModeList(const ui::DisplaySnapshot& output); | |
| 42 | |
| 43 DisplayChangeObserver(ui::DisplayConfigurator* display_configurator, | |
| 44 display::DisplayManager* display_manager); | |
| 45 ~DisplayChangeObserver() override; | |
| 46 | |
| 47 // ui::DisplayConfigurator::StateController overrides: | |
| 48 ui::MultipleDisplayState GetStateForDisplayIds( | |
| 49 const ui::DisplayConfigurator::DisplayStateList& outputs) const override; | |
| 50 bool GetResolutionForDisplayId(int64_t display_id, | |
| 51 gfx::Size* size) const override; | |
| 52 | |
| 53 // Overriden from ui::DisplayConfigurator::Observer: | |
| 54 void OnDisplayModeChanged( | |
| 55 const ui::DisplayConfigurator::DisplayStateList& outputs) override; | |
| 56 void OnDisplayModeChangeFailed( | |
| 57 const ui::DisplayConfigurator::DisplayStateList& displays, | |
| 58 ui::MultipleDisplayState failed_new_state) override; | |
| 59 | |
| 60 // Overriden from ui::InputDeviceEventObserver: | |
| 61 void OnTouchscreenDeviceConfigurationChanged() override; | |
| 62 | |
| 63 // Exposed for testing. | |
| 64 ASH_EXPORT static float FindDeviceScaleFactor(float dpi); | |
| 65 | |
| 66 private: | |
| 67 // Both |display_configurator_| and |display_manager_| are not owned and must | |
| 68 // outlive DisplayChangeObserver. | |
| 69 ui::DisplayConfigurator* display_configurator_; | |
| 70 display::DisplayManager* display_manager_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver); | |
| 73 }; | |
| 74 | |
| 75 } // namespace ash | |
| 76 | |
| 77 #endif // ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_ | |
| OLD | NEW |