Chromium Code Reviews| Index: ui/display/fake_display_snapshot.cc |
| diff --git a/ui/display/fake_display_snapshot.cc b/ui/display/fake_display_snapshot.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cf6f44c6729f32d42476f1bc1c18da8d7106717c |
| --- /dev/null |
| +++ b/ui/display/fake_display_snapshot.cc |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ui/display/fake_display_snapshot.h" |
| + |
| +#include <vector> |
| + |
| +#include "base/strings/stringprintf.h" |
| + |
| +namespace display { |
| + |
| +namespace { |
| + |
| +// For a non high-DPI display (96 dpi) use a pitch of 265µm. |
| +static const float kDisplayPitchMM = 0.265; |
| + |
| +} // namespace |
| + |
| +FakeDisplaySnapshot::FakeDisplaySnapshot(int64_t display_id, |
| + const gfx::Size& display_size, |
| + ui::DisplayConnectionType type) |
| + : DisplaySnapshot(display_id, |
| + gfx::Point(0, 0), |
| + gfx::Size(display_size.width() * kDisplayPitchMM, |
| + display_size.height() * kDisplayPitchMM), |
| + type, |
| + false, |
| + false, |
| + false, |
| + "Fake Display", |
|
rjkroege
2016/09/15 00:52:46
given that there could be more than one, can you g
kylechar
2016/09/15 17:31:55
Done.
|
| + base::FilePath(), |
| + std::vector<std::unique_ptr<const ui::DisplayMode>>(), |
| + std::vector<uint8_t>(), |
| + nullptr, |
| + nullptr) { |
| + ui::DisplayMode mode(display_size, false, 60.0f); |
| + modes_.push_back(mode.Clone()); |
| + |
| + native_mode_ = modes_.front().get(); |
| +} |
| + |
| +FakeDisplaySnapshot::~FakeDisplaySnapshot() {} |
| + |
| +std::string FakeDisplaySnapshot::ToString() const { |
| + return base::StringPrintf( |
| + "id=%ld current_mode=%s physical_size=%s", display_id_, |
| + current_mode_ ? current_mode_->ToString().c_str() : "nullptr", |
| + physical_size_.ToString().c_str()); |
| +} |
| + |
| +} // namespace display |