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