Chromium Code Reviews| Index: ui/display/chromeos/display_change_observer.h |
| diff --git a/ash/display/display_change_observer_chromeos.h b/ui/display/chromeos/display_change_observer.h |
| similarity index 59% |
| rename from ash/display/display_change_observer_chromeos.h |
| rename to ui/display/chromeos/display_change_observer.h |
| index 8e61ae4ec3b05af6268a937073a356ff341a2349..4bc217f2a8763a74fc9598c2f18a1ca3a7dfa03d 100644 |
| --- a/ash/display/display_change_observer_chromeos.h |
| +++ b/ui/display/chromeos/display_change_observer.h |
| @@ -2,50 +2,48 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_ |
| -#define ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_ |
| +#ifndef UI_DISPLAY_CHROMEOS_DISPLAY_CHANGE_OBSERVER_H_ |
| +#define UI_DISPLAY_CHROMEOS_DISPLAY_CHANGE_OBSERVER_H_ |
| #include <stdint.h> |
| #include <memory> |
| #include <vector> |
| -#include "ash/ash_export.h" |
| +#include "base/callback.h" |
| #include "base/macros.h" |
| #include "ui/display/chromeos/display_configurator.h" |
| +#include "ui/display/display_export.h" |
| #include "ui/display/manager/display_string_provider.h" |
| #include "ui/display/manager/managed_display_info.h" |
| #include "ui/events/devices/input_device_event_observer.h" |
| namespace display { |
| -class DisplayManager; |
| -} |
| - |
| -namespace ash { |
| +class DisplayManager; |
| class DisplaySnapshot; |
| // An object that observes changes in display configuration and updates |
| // DisplayManager. |
| -class DisplayChangeObserver : public ui::DisplayConfigurator::StateController, |
| - public ui::DisplayConfigurator::Observer, |
| - public ui::InputDeviceEventObserver { |
| +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.
|
| + : public ui::DisplayConfigurator::StateController, |
| + public ui::DisplayConfigurator::Observer, |
| + public ui::InputDeviceEventObserver { |
| public: |
| // Returns the mode list for internal display. |
| - ASH_EXPORT static display::ManagedDisplayInfo::ManagedDisplayModeList |
| - GetInternalManagedDisplayModeList( |
| - const display::ManagedDisplayInfo& display_info, |
| - const ui::DisplaySnapshot& output); |
| + DISPLAY_EXPORT static ManagedDisplayInfo::ManagedDisplayModeList |
| + GetInternalManagedDisplayModeList(const ManagedDisplayInfo& display_info, |
| + const ui::DisplaySnapshot& output); |
| // Returns the resolution list. |
| - ASH_EXPORT static display::ManagedDisplayInfo::ManagedDisplayModeList |
| + DISPLAY_EXPORT static ManagedDisplayInfo::ManagedDisplayModeList |
| GetExternalManagedDisplayModeList(const ui::DisplaySnapshot& output); |
| explicit DisplayChangeObserver( |
| - std::unique_ptr<display::DisplayStringProvider> string_provider); |
| + std::unique_ptr<DisplayStringProvider> string_provider); |
| ~DisplayChangeObserver() override; |
| - void set_display_manager(display::DisplayManager* display_manager) { |
| + void set_display_manager(DisplayManager* display_manager) { |
| display_manager_ = display_manager; |
| } |
| @@ -53,6 +51,11 @@ class DisplayChangeObserver : public ui::DisplayConfigurator::StateController, |
| display_configurator_ = display_configurator; |
| } |
| + // Sets callback to be called when the display state is potentially changing. |
| + void set_display_changing_callback(base::Closure display_changing_callback) { |
| + display_changing_callback_ = display_changing_callback; |
| + } |
| + |
| // ui::DisplayConfigurator::StateController overrides: |
| ui::MultipleDisplayState GetStateForDisplayIds( |
| const ui::DisplayConfigurator::DisplayStateList& outputs) const override; |
| @@ -70,16 +73,19 @@ class DisplayChangeObserver : public ui::DisplayConfigurator::StateController, |
| void OnTouchscreenDeviceConfigurationChanged() override; |
| // Exposed for testing. |
| - ASH_EXPORT static float FindDeviceScaleFactor(float dpi); |
| + DISPLAY_EXPORT static float FindDeviceScaleFactor(float dpi); |
| private: |
| - std::unique_ptr<display::DisplayStringProvider> string_provider_; |
| - display::DisplayManager* display_manager_ = nullptr; |
| + std::unique_ptr<DisplayStringProvider> string_provider_; |
| + DisplayManager* display_manager_ = nullptr; |
| ui::DisplayConfigurator* display_configurator_ = nullptr; |
| + // Called when display state is about to change. |
| + base::Closure display_changing_callback_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver); |
| }; |
| -} // namespace ash |
| +} // namespace display |
| -#endif // ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_ |
| +#endif // UI_DISPLAY_CHROMEOS_DISPLAY_CHANGE_OBSERVER_H_ |