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