Home | History | Annotate | Download | only in display
      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 #include "ui/events/input_device_event_observer.h"
     13 
     14 namespace ash {
     15 
     16 class DisplayInfo;
     17 struct DisplayMode;
     18 
     19 // An object that observes changes in display configuration and
     20 // update DisplayManagers.
     21 class DisplayChangeObserver : public ui::DisplayConfigurator::StateController,
     22                               public ui::DisplayConfigurator::Observer,
     23                               public ui::InputDeviceEventObserver,
     24                               public ShellObserver {
     25  public:
     26   // Returns the mode list for internal display.
     27   ASH_EXPORT static std::vector<DisplayMode> GetInternalDisplayModeList(
     28       const DisplayInfo& display_info,
     29       const ui::DisplayConfigurator::DisplayState& output);
     30 
     31   // Returns the resolution list.
     32   ASH_EXPORT static std::vector<DisplayMode> GetExternalDisplayModeList(
     33       const ui::DisplayConfigurator::DisplayState& output);
     34 
     35   DisplayChangeObserver();
     36   virtual ~DisplayChangeObserver();
     37 
     38   // ui::DisplayConfigurator::StateController overrides:
     39   virtual ui::MultipleDisplayState GetStateForDisplayIds(
     40       const std::vector<int64>& outputs) const OVERRIDE;
     41   virtual bool GetResolutionForDisplayId(int64 display_id,
     42                                          gfx::Size* size) const OVERRIDE;
     43 
     44   // Overriden from ui::DisplayConfigurator::Observer:
     45   virtual void OnDisplayModeChanged(
     46       const ui::DisplayConfigurator::DisplayStateList& outputs) OVERRIDE;
     47 
     48   // Overriden from ui::InputDeviceEventObserver:
     49   virtual void OnInputDeviceConfigurationChanged() OVERRIDE;
     50 
     51   // Overriden from ShellObserver:
     52   virtual void OnAppTerminating() OVERRIDE;
     53 
     54   // Exposed for testing.
     55   ASH_EXPORT static float FindDeviceScaleFactor(float dpi);
     56 
     57  private:
     58   DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserver);
     59 };
     60 
     61 }  // namespace ash
     62 
     63 #endif  // ASH_DISPLAY_AURA_DISPLAY_CHANGE_OBSERVER_CHROMEOS_H
     64