diff options
author | dnicoara@chromium.org <dnicoara@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-04 22:10:49 +0000 |
---|---|---|
committer | dnicoara@chromium.org <dnicoara@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-04 22:10:49 +0000 |
commit | 96e9c3c67d8ece260bfbd706217dd1031a85213f (patch) | |
tree | 6f771f5999ffe0e039cf15772159633cbebecb53 /ui/display/chromeos | |
parent | e0168050a9a73fdf7b968cf5ee0091b6059ca259 (diff) | |
download | chromium_src-96e9c3c67d8ece260bfbd706217dd1031a85213f.zip chromium_src-96e9c3c67d8ece260bfbd706217dd1031a85213f.tar.gz chromium_src-96e9c3c67d8ece260bfbd706217dd1031a85213f.tar.bz2 |
Set display name & overscan flag on DisplaySnapshot creation
This moves the requirement of getting the display name & overscan flag from the
DisplaySnapshot object to NativeDisplayDelegate.
BUG=333413
Review URL: https://codereview.chromium.org/226283002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261896 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/display/chromeos')
8 files changed, 30 insertions, 28 deletions
diff --git a/ui/display/chromeos/display_snapshot.cc b/ui/display/chromeos/display_snapshot.cc index db55dea..8f9eb15 100644 --- a/ui/display/chromeos/display_snapshot.cc +++ b/ui/display/chromeos/display_snapshot.cc @@ -12,6 +12,8 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id, const gfx::Size& physical_size, OutputType type, bool is_aspect_preserving_scaling, + bool has_overscan, + std::string display_name, const std::vector<const DisplayMode*>& modes, const DisplayMode* current_mode, const DisplayMode* native_mode) @@ -21,6 +23,8 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id, physical_size_(physical_size), type_(type), is_aspect_preserving_scaling_(is_aspect_preserving_scaling), + has_overscan_(has_overscan), + display_name_(display_name), modes_(modes), current_mode_(current_mode), native_mode_(native_mode) {} diff --git a/ui/display/chromeos/display_snapshot.h b/ui/display/chromeos/display_snapshot.h index 4af150c..e2d7ea7 100644 --- a/ui/display/chromeos/display_snapshot.h +++ b/ui/display/chromeos/display_snapshot.h @@ -26,6 +26,8 @@ class DISPLAY_EXPORT DisplaySnapshot { const gfx::Size& physical_size, OutputType type, bool is_aspect_preserving_scaling, + bool has_overscan, + std::string display_name, const std::vector<const DisplayMode*>& modes, const DisplayMode* current_mode, const DisplayMode* native_mode); @@ -37,6 +39,9 @@ class DISPLAY_EXPORT DisplaySnapshot { bool is_aspect_preserving_scaling() const { return is_aspect_preserving_scaling_; } + bool has_overscan() const { return has_overscan_; } + std::string display_name() const { return display_name_; } + int64_t display_id() const { return display_id_; } bool has_proper_display_id() const { return has_proper_display_id_; } @@ -49,14 +54,6 @@ class DISPLAY_EXPORT DisplaySnapshot { void set_origin(const gfx::Point& origin) { origin_ = origin; } void add_mode(const DisplayMode* mode) { modes_.push_back(mode); } - // Generates the human readable string for this display. Generally this is - // parsed from the EDID information. - virtual std::string GetDisplayName() = 0; - - // Returns true if the overscan flag is set to true in the display - // information. Generally this is read from the EDID flags. - virtual bool GetOverscanFlag() = 0; - // Returns a textual representation of this display state. virtual std::string ToString() const = 0; @@ -74,6 +71,10 @@ class DISPLAY_EXPORT DisplaySnapshot { bool is_aspect_preserving_scaling_; + bool has_overscan_; + + std::string display_name_; + std::vector<const DisplayMode*> modes_; // Not owned. // Mode currently being used by the output. diff --git a/ui/display/chromeos/test/test_display_snapshot.cc b/ui/display/chromeos/test/test_display_snapshot.cc index 90211f8..e9797dd 100644 --- a/ui/display/chromeos/test/test_display_snapshot.cc +++ b/ui/display/chromeos/test/test_display_snapshot.cc @@ -12,6 +12,8 @@ TestDisplaySnapshot::TestDisplaySnapshot() gfx::Size(0, 0), OUTPUT_TYPE_UNKNOWN, false, + false, + std::string(), std::vector<const DisplayMode*>(), NULL, NULL) {} @@ -32,16 +34,14 @@ TestDisplaySnapshot::TestDisplaySnapshot( physical_size, type, is_aspect_preserving_scaling, + false, + std::string(), modes, current_mode, native_mode) {} TestDisplaySnapshot::~TestDisplaySnapshot() {} -std::string TestDisplaySnapshot::GetDisplayName() { return ""; } - -bool TestDisplaySnapshot::GetOverscanFlag() { return false; } - std::string TestDisplaySnapshot::ToString() const { return ""; } } // namespace ui diff --git a/ui/display/chromeos/test/test_display_snapshot.h b/ui/display/chromeos/test/test_display_snapshot.h index f1e94f2..adc1c41 100644 --- a/ui/display/chromeos/test/test_display_snapshot.h +++ b/ui/display/chromeos/test/test_display_snapshot.h @@ -38,8 +38,6 @@ class DISPLAY_EXPORT TestDisplaySnapshot : public DisplaySnapshot { } // DisplaySnapshot overrides: - virtual std::string GetDisplayName() OVERRIDE; - virtual bool GetOverscanFlag() OVERRIDE; virtual std::string ToString() const OVERRIDE; private: diff --git a/ui/display/chromeos/x11/display_snapshot_x11.cc b/ui/display/chromeos/x11/display_snapshot_x11.cc index 9228a07..ee28d58 100644 --- a/ui/display/chromeos/x11/display_snapshot_x11.cc +++ b/ui/display/chromeos/x11/display_snapshot_x11.cc @@ -6,7 +6,6 @@ #include "base/strings/stringprintf.h" #include "ui/display/chromeos/x11/display_mode_x11.h" -#include "ui/display/x11/edid_parser_x11.h" namespace ui { @@ -17,6 +16,8 @@ DisplaySnapshotX11::DisplaySnapshotX11( const gfx::Size& physical_size, OutputType type, bool is_aspect_preserving_scaling, + bool has_overscan, + std::string display_name, const std::vector<const DisplayMode*>& modes, const DisplayMode* current_mode, const DisplayMode* native_mode, @@ -29,6 +30,8 @@ DisplaySnapshotX11::DisplaySnapshotX11( physical_size, type, is_aspect_preserving_scaling, + has_overscan, + display_name, modes, current_mode, native_mode), @@ -38,17 +41,6 @@ DisplaySnapshotX11::DisplaySnapshotX11( DisplaySnapshotX11::~DisplaySnapshotX11() {} -std::string DisplaySnapshotX11::GetDisplayName() { - return ui::GetDisplayName(output_); -} - -bool DisplaySnapshotX11::GetOverscanFlag() { - bool flag = false; - GetOutputOverscanFlag(output_, &flag); - - return flag; -} - std::string DisplaySnapshotX11::ToString() const { return base::StringPrintf( "[type=%d, output=%ld, crtc=%ld, mode=%ld, dim=%dx%d]", diff --git a/ui/display/chromeos/x11/display_snapshot_x11.h b/ui/display/chromeos/x11/display_snapshot_x11.h index fe2ff8d..178ff0d 100644 --- a/ui/display/chromeos/x11/display_snapshot_x11.h +++ b/ui/display/chromeos/x11/display_snapshot_x11.h @@ -22,6 +22,8 @@ class DISPLAY_EXPORT DisplaySnapshotX11 : public DisplaySnapshot { const gfx::Size& physical_size, OutputType type, bool is_aspect_preserving_scaling, + bool has_overscan, + std::string display_name, const std::vector<const DisplayMode*>& modes, const DisplayMode* current_mode, const DisplayMode* native_mode, @@ -35,8 +37,6 @@ class DISPLAY_EXPORT DisplaySnapshotX11 : public DisplaySnapshot { int index() const { return index_; } // DisplaySnapshot overrides: - virtual std::string GetDisplayName() OVERRIDE; - virtual bool GetOverscanFlag() OVERRIDE; virtual std::string ToString() const OVERRIDE; private: diff --git a/ui/display/chromeos/x11/native_display_delegate_x11.cc b/ui/display/chromeos/x11/native_display_delegate_x11.cc index 8f687c9..9e3c144 100644 --- a/ui/display/chromeos/x11/native_display_delegate_x11.cc +++ b/ui/display/chromeos/x11/native_display_delegate_x11.cc @@ -346,6 +346,9 @@ DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot( bool has_display_id = GetDisplayId( id, static_cast<uint8_t>(index), &display_id); + bool has_overscan = false; + GetOutputOverscanFlag(id, &has_overscan); + OutputType type = GetOutputTypeFromName(info->name); if (type == OUTPUT_TYPE_UNKNOWN) LOG(ERROR) << "Unknown link type: " << info->name; @@ -406,6 +409,8 @@ DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot( gfx::Size(info->mm_width, info->mm_height), type, IsOutputAspectPreservingScaling(id), + has_overscan, + GetDisplayName(id), display_modes, current_mode, native_mode, diff --git a/ui/display/chromeos/x11/native_display_event_dispatcher_x11_unittest.cc b/ui/display/chromeos/x11/native_display_event_dispatcher_x11_unittest.cc index d43a630..3e27054 100644 --- a/ui/display/chromeos/x11/native_display_event_dispatcher_x11_unittest.cc +++ b/ui/display/chromeos/x11/native_display_event_dispatcher_x11_unittest.cc @@ -28,6 +28,8 @@ DisplaySnapshotX11* CreateOutput(RROutput output, RRCrtc crtc) { gfx::Size(0, 0), OUTPUT_TYPE_UNKNOWN, false, + false, + std::string(), std::vector<const DisplayMode*>(1, &kDefaultDisplayMode), &kDefaultDisplayMode, NULL, |