summaryrefslogtreecommitdiffstats
path: root/ash/display/display_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'ash/display/display_manager.h')
-rw-r--r--ash/display/display_manager.h75
1 files changed, 51 insertions, 24 deletions
diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h
index 541ea4b..25be7c1 100644
--- a/ash/display/display_manager.h
+++ b/ash/display/display_manager.h
@@ -9,7 +9,6 @@
#include <vector>
#include "ash/ash_export.h"
-#include "ash/display/display_info.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "ui/aura/root_window_observer.h"
@@ -77,9 +76,6 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver {
// display's bounds change.
void SetOverscanInsets(int64 display_id, const gfx::Insets& insets_in_dip);
- // Clears the overscan insets
- void ClearCustomOverscanInsets(int64 display_id);
-
// Returns the current overscan insets for the specified |display_id|.
// Returns an empty insets (0, 0, 0, 0) if no insets are specified for
// the display.
@@ -88,11 +84,10 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver {
// Called when display configuration has changed. The new display
// configurations is passed as a vector of Display object, which
// contains each display's new infomration.
- void OnNativeDisplaysChanged(
- const std::vector<DisplayInfo>& display_info_list);
+ void OnNativeDisplaysChanged(const std::vector<gfx::Display>& displays);
// Updates the internal display data and notifies observers about the changes.
- void UpdateDisplays(const std::vector<DisplayInfo>& display_info_list);
+ void UpdateDisplays(const std::vector<gfx::Display>& displays);
// Create a root window for given |display|.
aura::RootWindow* CreateRootWindowForDisplay(const gfx::Display& display);
@@ -102,8 +97,6 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver {
// no longer considered "primary".
gfx::Display* GetDisplayAt(size_t index);
- const gfx::Display* GetPrimaryDisplayCandidate() const;
-
size_t GetNumDisplays() const;
// Returns the display object nearest given |window|.
@@ -118,9 +111,6 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver {
const gfx::Display& GetDisplayMatching(
const gfx::Rect& match_rect)const;
- // Retuns the display info associated with |display|.
- const DisplayInfo& GetDisplayInfo(const gfx::Display& display) const;
-
// Returns the human-readable name for the display specified by |display|.
std::string GetDisplayNameFor(const gfx::Display& display);
@@ -141,6 +131,29 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver {
typedef std::vector<gfx::Display> DisplayList;
+ // Metadata for each display.
+ struct DisplayInfo {
+ DisplayInfo();
+
+ // The cached name of the display.
+ std::string name;
+
+ // The original bounds_in_pixel for the display. This can be different from
+ // the current one in case of overscan insets.
+ gfx::Rect original_bounds_in_pixel;
+
+ // The overscan insets for the display.
+ gfx::Insets overscan_insets_in_dip;
+
+ // True if we detect that the display has overscan area. False if the
+ // display doesn't have it, or failed to detect it.
+ bool has_overscan;
+
+ // True if the |overscan_insets_in_dip| is specified. This is set because
+ // the user may specify an empty inset intentionally.
+ bool has_custom_overscan_insets;
+ };
+
void Init();
void CycleDisplayImpl();
void ScaleDisplayImpl();
@@ -151,26 +164,30 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver {
// Refer to |CreateDisplayFromSpec| API for the format of |spec|.
void AddDisplayFromSpec(const std::string& spec);
+ // Set the 1st display as an internal display and returns the display Id for
+ // the internal display.
+ int64 SetFirstDisplayAsInternalDisplayForTest();
+
// Checks if the mouse pointer is on one of displays, and moves to
// the center of the nearest display if it's outside of all displays.
void EnsurePointerInDisplays();
- // Inserts and update the DisplayInfo according to the overscan
- // state. Note that The DisplayInfo stored in the |internal_display_info_|
- // can be different from |new_info| (due to overscan state), so
- // you must use |GetDisplayInfo| to get the correct DisplayInfo for
- // a display.
- void InsertAndUpdateDisplayInfo(const DisplayInfo& new_info,
- bool can_overscan);
+ // Updates |display_info_| by calling platform-dependent functions.
+ void RefreshDisplayInfo();
+
+ // Update the display's id in the |display_list| to match the ones
+ // stored in this display manager's |displays_|. This is used to
+ // emulate display change behavior during the test byn creating the
+ // display list with the same display ids but with different bounds
+ void SetDisplayIdsForTest(DisplayList* display_list) const;
- // Creates a display object from the DisplayInfo for |display_id|.
- gfx::Display CreateDisplayFromDisplayInfoById(int64 display_id);
+ // Forcibly specify 'has_overscan' flag of the DisplayInfo for specified |id|.
+ void SetHasOverscanFlagForTest(int64 id, bool has_overscan);
DisplayList displays_;
- // An internal display info cache used when the internal display is
- // disconnectd.
- scoped_ptr<DisplayInfo> internal_display_info_;
+ // An internal display cache used when the internal display is disconnectd.
+ scoped_ptr<gfx::Display> internal_display_;
bool force_bounds_changed_;
@@ -180,6 +197,16 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver {
DISALLOW_COPY_AND_ASSIGN(DisplayManager);
};
+// Creates a display from string spec. 100+200-1440x800 creates display
+// whose size is 1440x800 at the location (100, 200) in screen's coordinates.
+// The location can be omitted and be just "1440x800", which creates
+// display at the origin of the screen. An empty string creates
+// the display with default size.
+// The device scale factor can be specified by "*", like "1280x780*2",
+// or will use the value of |gfx::Display::GetForcedDeviceScaleFactor()| if
+// --force-device-scale-factor is specified.
+ASH_EXPORT gfx::Display CreateDisplayFromSpec(const std::string& str);
+
extern const aura::WindowProperty<int64>* const kDisplayIdKey;
} // namespace internal