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
8 #include "ash/ash_export.h"
9 #include "ash/shell_observer.h"
10 #include "base/basictypes.h"
11 #include "ui/display/chromeos/display_configurator.h"
18 // An object that observes changes in display configuration and
19 // update DisplayManagers.
20 class DisplayChangeObserver
: public ui::DisplayConfigurator::StateController
,
21 public ui::DisplayConfigurator::Observer
,
22 public ShellObserver
{
24 // Returns the mode list for internal display.
25 ASH_EXPORT
static std::vector
<DisplayMode
> GetInternalDisplayModeList(
26 const DisplayInfo
& display_info
,
27 const ui::DisplayConfigurator::DisplayState
& output
);
29 // Returns the resolution list.
30 ASH_EXPORT
static std::vector
<DisplayMode
> GetExternalDisplayModeList(
31 const ui::DisplayConfigurator::DisplayState
& output
);
33 DisplayChangeObserver();
34 virtual ~DisplayChangeObserver();
36 // ui::DisplayConfigurator::StateController overrides:
37 virtual ui::MultipleDisplayState
GetStateForDisplayIds(
38 const std::vector
<int64
>& outputs
) const OVERRIDE
;
39 virtual bool GetResolutionForDisplayId(int64 display_id
,
40 gfx::Size
* size
) const OVERRIDE
;
42 // Overriden from ui::DisplayConfigurator::Observer:
43 virtual void OnDisplayModeChanged(
44 const ui::DisplayConfigurator::DisplayStateList
& outputs
) OVERRIDE
;
46 // Overriden from ShellObserver:
47 virtual void OnAppTerminating() OVERRIDE
;
49 // Exposed for testing.
50 ASH_EXPORT
static float FindDeviceScaleFactor(float dpi
);
53 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver
);
58 #endif // ASH_DISPLAY_AURA_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H