OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_X11_H | 5 #ifndef ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H |
6 #define ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_X11_H | 6 #define ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H |
7 | |
8 #include <X11/Xlib.h> | |
9 | |
10 // Xlib.h defines RootWindow. | |
11 #undef RootWindow | |
12 | 7 |
13 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
14 #include "ash/shell_observer.h" | 9 #include "ash/shell_observer.h" |
15 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
16 #include "chromeos/display/output_configurator.h" | 11 #include "chromeos/display/output_configurator.h" |
17 | 12 |
18 namespace ash { | 13 namespace ash { |
19 namespace internal { | 14 namespace internal { |
20 | 15 |
| 16 struct Resolution; |
| 17 |
21 // An object that observes changes in display configuration and | 18 // An object that observes changes in display configuration and |
22 // update DisplayManagers. | 19 // update DisplayManagers. |
23 class DisplayChangeObserverX11 | 20 class DisplayChangeObserver |
24 : public chromeos::OutputConfigurator::StateController, | 21 : public chromeos::OutputConfigurator::StateController, |
25 public chromeos::OutputConfigurator::Observer, | 22 public chromeos::OutputConfigurator::Observer, |
26 public ShellObserver { | 23 public ShellObserver { |
27 public: | 24 public: |
28 DisplayChangeObserverX11(); | 25 // Returns true if the size info in the output_info isn't valid |
29 virtual ~DisplayChangeObserverX11(); | 26 // and should be ignored. This is exposed for testing. |
| 27 // |mm_width| and |mm_height| are given in millimeters. |
| 28 ASH_EXPORT static bool ShouldIgnoreSize(unsigned long mm_width, |
| 29 unsigned long mm_height); |
| 30 |
| 31 // Returns the resolution list. |
| 32 ASH_EXPORT static std::vector<Resolution> GetResolutionList( |
| 33 const chromeos::OutputConfigurator::OutputSnapshot& output); |
| 34 |
| 35 DisplayChangeObserver(); |
| 36 virtual ~DisplayChangeObserver(); |
30 | 37 |
31 // chromeos::OutputConfigurator::StateController overrides: | 38 // chromeos::OutputConfigurator::StateController overrides: |
32 virtual chromeos::OutputState GetStateForDisplayIds( | 39 virtual chromeos::OutputState GetStateForDisplayIds( |
33 const std::vector<int64>& outputs) const OVERRIDE; | 40 const std::vector<int64>& outputs) const OVERRIDE; |
34 virtual bool GetResolutionForDisplayId(int64 display_id, | 41 virtual bool GetResolutionForDisplayId(int64 display_id, |
35 int* width, | 42 int* width, |
36 int* height) const OVERRIDE; | 43 int* height) const OVERRIDE; |
37 | 44 |
38 // Overriden from chromeos::OutputConfigurator::Observer: | 45 // Overriden from chromeos::OutputConfigurator::Observer: |
39 virtual void OnDisplayModeChanged( | 46 virtual void OnDisplayModeChanged( |
40 const std::vector<chromeos::OutputConfigurator::OutputSnapshot>& outputs) | 47 const std::vector<chromeos::OutputConfigurator::OutputSnapshot>& outputs) |
41 OVERRIDE; | 48 OVERRIDE; |
42 | 49 |
43 // Overriden from ShellObserver: | 50 // Overriden from ShellObserver: |
44 virtual void OnAppTerminating() OVERRIDE; | 51 virtual void OnAppTerminating() OVERRIDE; |
45 | 52 |
46 private: | 53 private: |
47 Display* xdisplay_; | 54 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver); |
48 | |
49 ::Window x_root_window_; | |
50 | |
51 int xrandr_event_base_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserverX11); | |
54 }; | 55 }; |
55 | 56 |
56 } // namespace internal | 57 } // namespace internal |
57 } // namespace ash | 58 } // namespace ash |
58 | 59 |
59 #endif // ASH_DISPLAY_AURA_DISPLAY_CHANGE_OBSERVER_X11_H | 60 #endif // ASH_DISPLAY_AURA_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H |
OLD | NEW |