OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H | 5 #ifndef ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H |
6 #define ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H | 6 #define ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/shell_observer.h" | 9 #include "ash/shell_observer.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "ui/display/chromeos/display_configurator.h" | 11 #include "ui/display/chromeos/display_configurator.h" |
12 | 12 |
13 namespace ash { | 13 namespace ash { |
14 | 14 |
15 struct DisplayMode; | 15 struct DisplayMode; |
16 | 16 |
17 // An object that observes changes in display configuration and | 17 // An object that observes changes in display configuration and |
18 // update DisplayManagers. | 18 // update DisplayManagers. |
19 class DisplayChangeObserver : public ui::DisplayConfigurator::StateController, | 19 class DisplayChangeObserver : public ui::DisplayConfigurator::StateController, |
20 public ui::DisplayConfigurator::Observer, | 20 public ui::DisplayConfigurator::Observer, |
21 public ShellObserver { | 21 public ShellObserver { |
22 public: | 22 public: |
23 // Returns the resolution list. | 23 // Returns the resolution list. |
24 ASH_EXPORT static std::vector<DisplayMode> GetDisplayModeList( | 24 ASH_EXPORT static std::vector<DisplayMode> GetDisplayModeList( |
25 const ui::DisplayConfigurator::DisplayState& output); | 25 const ui::DisplayConfigurator::DisplayState& output); |
26 | 26 |
| 27 // Returns the device scale factor for the specific monitor and mode. |
| 28 ASH_EXPORT static float GetScaleFactor( |
| 29 const gfx::Size& physical_size, |
| 30 const gfx::Size& screen_size); |
| 31 |
27 DisplayChangeObserver(); | 32 DisplayChangeObserver(); |
28 virtual ~DisplayChangeObserver(); | 33 virtual ~DisplayChangeObserver(); |
29 | 34 |
30 // ui::DisplayConfigurator::StateController overrides: | 35 // ui::DisplayConfigurator::StateController overrides: |
31 virtual ui::MultipleDisplayState GetStateForDisplayIds( | 36 virtual ui::MultipleDisplayState GetStateForDisplayIds( |
32 const std::vector<int64>& outputs) const OVERRIDE; | 37 const std::vector<int64>& outputs) const OVERRIDE; |
33 virtual bool GetResolutionForDisplayId(int64 display_id, | 38 virtual bool GetResolutionForDisplayId(int64 display_id, |
34 gfx::Size* size) const OVERRIDE; | 39 gfx::Size* size) const OVERRIDE; |
35 | 40 |
36 // Overriden from ui::DisplayConfigurator::Observer: | 41 // Overriden from ui::DisplayConfigurator::Observer: |
37 virtual void OnDisplayModeChanged( | 42 virtual void OnDisplayModeChanged( |
38 const ui::DisplayConfigurator::DisplayStateList& outputs) OVERRIDE; | 43 const ui::DisplayConfigurator::DisplayStateList& outputs) OVERRIDE; |
39 | 44 |
40 // Overriden from ShellObserver: | 45 // Overriden from ShellObserver: |
41 virtual void OnAppTerminating() OVERRIDE; | 46 virtual void OnAppTerminating() OVERRIDE; |
42 | 47 |
43 private: | 48 private: |
44 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver); | 49 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver); |
45 }; | 50 }; |
46 | 51 |
47 } // namespace ash | 52 } // namespace ash |
48 | 53 |
49 #endif // ASH_DISPLAY_AURA_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H | 54 #endif // ASH_DISPLAY_AURA_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H |
OLD | NEW |