Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ash / display / display_change_observer_chromeos.h
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.
4
5 #ifndef ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H
6 #define ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H
7
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"
12
13 namespace ash {
14
15 class DisplayInfo;
16 struct DisplayMode;
17
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 {
23  public:
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);
28
29   // Returns the resolution list.
30   ASH_EXPORT static std::vector<DisplayMode> GetExternalDisplayModeList(
31       const ui::DisplayConfigurator::DisplayState& output);
32
33   DisplayChangeObserver();
34   virtual ~DisplayChangeObserver();
35
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;
41
42   // Overriden from ui::DisplayConfigurator::Observer:
43   virtual void OnDisplayModeChanged(
44       const ui::DisplayConfigurator::DisplayStateList& outputs) OVERRIDE;
45
46   // Overriden from ShellObserver:
47   virtual void OnAppTerminating() OVERRIDE;
48
49   // Exposed for testing.
50   ASH_EXPORT static float FindDeviceScaleFactor(float dpi);
51
52  private:
53   DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver);
54 };
55
56 }  // namespace ash
57
58 #endif  // ASH_DISPLAY_AURA_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H