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
3 // found in the LICENSE file.
5 #ifndef ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_
6 #define ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_
10 #include "ash/ash_export.h"
11 #include "ash/shell_observer.h"
12 #include "base/basictypes.h"
13 #include "ui/display/chromeos/display_configurator.h"
14 #include "ui/events/devices/input_device_event_observer.h"
21 // An object that observes changes in display configuration and
22 // update DisplayManagers.
23 class DisplayChangeObserver
: public ui::DisplayConfigurator::StateController
,
24 public ui::DisplayConfigurator::Observer
,
25 public ui::InputDeviceEventObserver
,
26 public ShellObserver
{
28 // Returns the mode list for internal display.
29 ASH_EXPORT
static std::vector
<DisplayMode
> GetInternalDisplayModeList(
30 const DisplayInfo
& display_info
,
31 const ui::DisplayConfigurator::DisplayState
& output
);
33 // Returns the resolution list.
34 ASH_EXPORT
static std::vector
<DisplayMode
> GetExternalDisplayModeList(
35 const ui::DisplayConfigurator::DisplayState
& output
);
37 DisplayChangeObserver();
38 ~DisplayChangeObserver() override
;
40 // ui::DisplayConfigurator::StateController overrides:
41 ui::MultipleDisplayState
GetStateForDisplayIds(
42 const std::vector
<int64
>& outputs
) const override
;
43 bool GetResolutionForDisplayId(int64 display_id
,
44 gfx::Size
* size
) const override
;
46 // Overriden from ui::DisplayConfigurator::Observer:
47 void OnDisplayModeChanged(
48 const ui::DisplayConfigurator::DisplayStateList
& outputs
) override
;
50 // Overriden from ui::InputDeviceEventObserver:
51 void OnTouchscreenDeviceConfigurationChanged() override
;
52 void OnKeyboardDeviceConfigurationChanged() override
;
53 void OnMouseDeviceConfigurationChanged() override
;
54 void OnTouchpadDeviceConfigurationChanged() override
;
56 // Overriden from ShellObserver:
57 void OnAppTerminating() override
;
59 // Exposed for testing.
60 ASH_EXPORT
static float FindDeviceScaleFactor(float dpi
);
63 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver
);
68 #endif // ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_