Chromium Code Reviews| 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_CHROMEOS_DISPLAY_CHANGE_OBSERVER_H_ |
| 6 #define ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_ | 6 #define UI_DISPLAY_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" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "ui/display/chromeos/display_configurator.h" | 15 #include "ui/display/chromeos/display_configurator.h" |
| 16 #include "ui/display/display_export.h" | |
| 16 #include "ui/display/manager/display_string_provider.h" | 17 #include "ui/display/manager/display_string_provider.h" |
| 17 #include "ui/display/manager/managed_display_info.h" | 18 #include "ui/display/manager/managed_display_info.h" |
| 18 #include "ui/events/devices/input_device_event_observer.h" | 19 #include "ui/events/devices/input_device_event_observer.h" |
| 19 | 20 |
| 20 namespace display { | 21 namespace display { |
| 22 | |
| 21 class DisplayManager; | 23 class DisplayManager; |
| 22 } | |
| 23 | |
| 24 namespace ash { | |
| 25 | |
| 26 class DisplaySnapshot; | 24 class DisplaySnapshot; |
| 27 | 25 |
| 28 // An object that observes changes in display configuration and updates | 26 // An object that observes changes in display configuration and updates |
| 29 // DisplayManager. | 27 // DisplayManager. |
| 30 class DisplayChangeObserver : public ui::DisplayConfigurator::StateController, | 28 class DISPLAY_EXPORT DisplayChangeObserver |
|
sadrul
2016/11/29 02:09:27
Hm. display::DisplayChangeObserver gets updates fr
kylechar
2016/11/29 14:37:07
I think it kind of just evolved this way. I tried
sadrul
2016/11/29 18:24:40
Oh yeah, that shouldn't happen with the file-move.
| |
| 31 public ui::DisplayConfigurator::Observer, | 29 : public ui::DisplayConfigurator::StateController, |
| 32 public ui::InputDeviceEventObserver { | 30 public ui::DisplayConfigurator::Observer, |
| 31 public ui::InputDeviceEventObserver { | |
| 33 public: | 32 public: |
| 34 // Returns the mode list for internal display. | 33 // Returns the mode list for internal display. |
| 35 ASH_EXPORT static display::ManagedDisplayInfo::ManagedDisplayModeList | 34 DISPLAY_EXPORT static ManagedDisplayInfo::ManagedDisplayModeList |
| 36 GetInternalManagedDisplayModeList( | 35 GetInternalManagedDisplayModeList(const ManagedDisplayInfo& display_info, |
| 37 const display::ManagedDisplayInfo& display_info, | 36 const ui::DisplaySnapshot& output); |
| 38 const ui::DisplaySnapshot& output); | |
| 39 | 37 |
| 40 // Returns the resolution list. | 38 // Returns the resolution list. |
| 41 ASH_EXPORT static display::ManagedDisplayInfo::ManagedDisplayModeList | 39 DISPLAY_EXPORT static ManagedDisplayInfo::ManagedDisplayModeList |
| 42 GetExternalManagedDisplayModeList(const ui::DisplaySnapshot& output); | 40 GetExternalManagedDisplayModeList(const ui::DisplaySnapshot& output); |
| 43 | 41 |
| 44 explicit DisplayChangeObserver( | 42 explicit DisplayChangeObserver( |
| 45 std::unique_ptr<display::DisplayStringProvider> string_provider); | 43 std::unique_ptr<DisplayStringProvider> string_provider); |
| 46 ~DisplayChangeObserver() override; | 44 ~DisplayChangeObserver() override; |
| 47 | 45 |
| 48 void set_display_manager(display::DisplayManager* display_manager) { | 46 void set_display_manager(DisplayManager* display_manager) { |
| 49 display_manager_ = display_manager; | 47 display_manager_ = display_manager; |
| 50 } | 48 } |
| 51 | 49 |
| 52 void set_display_configurator(ui::DisplayConfigurator* display_configurator) { | 50 void set_display_configurator(ui::DisplayConfigurator* display_configurator) { |
| 53 display_configurator_ = display_configurator; | 51 display_configurator_ = display_configurator; |
| 54 } | 52 } |
| 55 | 53 |
| 54 // Sets callback to be called when the display state is potentially changing. | |
| 55 void set_display_changing_callback(base::Closure display_changing_callback) { | |
| 56 display_changing_callback_ = display_changing_callback; | |
| 57 } | |
| 58 | |
| 56 // ui::DisplayConfigurator::StateController overrides: | 59 // ui::DisplayConfigurator::StateController overrides: |
| 57 ui::MultipleDisplayState GetStateForDisplayIds( | 60 ui::MultipleDisplayState GetStateForDisplayIds( |
| 58 const ui::DisplayConfigurator::DisplayStateList& outputs) const override; | 61 const ui::DisplayConfigurator::DisplayStateList& outputs) const override; |
| 59 bool GetResolutionForDisplayId(int64_t display_id, | 62 bool GetResolutionForDisplayId(int64_t display_id, |
| 60 gfx::Size* size) const override; | 63 gfx::Size* size) const override; |
| 61 | 64 |
| 62 // Overriden from ui::DisplayConfigurator::Observer: | 65 // Overriden from ui::DisplayConfigurator::Observer: |
| 63 void OnDisplayModeChanged( | 66 void OnDisplayModeChanged( |
| 64 const ui::DisplayConfigurator::DisplayStateList& outputs) override; | 67 const ui::DisplayConfigurator::DisplayStateList& outputs) override; |
| 65 void OnDisplayModeChangeFailed( | 68 void OnDisplayModeChangeFailed( |
| 66 const ui::DisplayConfigurator::DisplayStateList& displays, | 69 const ui::DisplayConfigurator::DisplayStateList& displays, |
| 67 ui::MultipleDisplayState failed_new_state) override; | 70 ui::MultipleDisplayState failed_new_state) override; |
| 68 | 71 |
| 69 // Overriden from ui::InputDeviceEventObserver: | 72 // Overriden from ui::InputDeviceEventObserver: |
| 70 void OnTouchscreenDeviceConfigurationChanged() override; | 73 void OnTouchscreenDeviceConfigurationChanged() override; |
| 71 | 74 |
| 72 // Exposed for testing. | 75 // Exposed for testing. |
| 73 ASH_EXPORT static float FindDeviceScaleFactor(float dpi); | 76 DISPLAY_EXPORT static float FindDeviceScaleFactor(float dpi); |
| 74 | 77 |
| 75 private: | 78 private: |
| 76 std::unique_ptr<display::DisplayStringProvider> string_provider_; | 79 std::unique_ptr<DisplayStringProvider> string_provider_; |
| 77 display::DisplayManager* display_manager_ = nullptr; | 80 DisplayManager* display_manager_ = nullptr; |
| 78 ui::DisplayConfigurator* display_configurator_ = nullptr; | 81 ui::DisplayConfigurator* display_configurator_ = nullptr; |
| 79 | 82 |
| 83 // Called when display state is about to change. | |
| 84 base::Closure display_changing_callback_; | |
| 85 | |
| 80 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver); | 86 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver); |
| 81 }; | 87 }; |
| 82 | 88 |
| 83 } // namespace ash | 89 } // namespace display |
| 84 | 90 |
| 85 #endif // ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_ | 91 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CHANGE_OBSERVER_H_ |
| OLD | NEW |