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"
20 class DisplaySnapshot
;
22 // An object that observes changes in display configuration and
23 // update DisplayManagers.
24 class DisplayChangeObserver
: public ui::DisplayConfigurator::StateController
,
25 public ui::DisplayConfigurator::Observer
,
26 public ui::InputDeviceEventObserver
,
27 public ShellObserver
{
29 // Returns the mode list for internal display.
30 ASH_EXPORT
static std::vector
<DisplayMode
> GetInternalDisplayModeList(
31 const DisplayInfo
& display_info
,
32 const ui::DisplaySnapshot
& output
);
34 // Returns the resolution list.
35 ASH_EXPORT
static std::vector
<DisplayMode
> GetExternalDisplayModeList(
36 const ui::DisplaySnapshot
& output
);
38 DisplayChangeObserver();
39 ~DisplayChangeObserver() override
;
41 // ui::DisplayConfigurator::StateController overrides:
42 ui::MultipleDisplayState
GetStateForDisplayIds(
43 const ui::DisplayConfigurator::DisplayStateList
& outputs
) const override
;
44 bool GetResolutionForDisplayId(int64 display_id
,
45 gfx::Size
* size
) const override
;
47 // Overriden from ui::DisplayConfigurator::Observer:
48 void OnDisplayModeChanged(
49 const ui::DisplayConfigurator::DisplayStateList
& outputs
) override
;
50 void OnDisplayModeChangeFailed(
51 const ui::DisplayConfigurator::DisplayStateList
& displays
,
52 ui::MultipleDisplayState failed_new_state
) override
;
54 // Overriden from ui::InputDeviceEventObserver:
55 void OnTouchscreenDeviceConfigurationChanged() override
;
57 // Overriden from ShellObserver:
58 void OnAppTerminating() override
;
60 // Exposed for testing.
61 ASH_EXPORT
static float FindDeviceScaleFactor(float dpi
);
64 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver
);
69 #endif // ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H_