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