Chromium Code Reviews| Index: ui/gfx/monitor.h |
| diff --git a/ui/gfx/monitor.h b/ui/gfx/monitor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d1b5c723113eef8978733678f2171f0fa4ae7dfd |
| --- /dev/null |
| +++ b/ui/gfx/monitor.h |
| @@ -0,0 +1,67 @@ |
| +// Copyright (c) 2012 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. |
| + |
| +#ifndef UI_GFX_MONITOR_H_ |
| +#define UI_GFX_MONITOR_H_ |
| +#pragma once |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "ui/base/ui_export.h" |
| +#include "ui/gfx/rect.h" |
| + |
| +namespace gfx { |
| + |
| +class UI_EXPORT Monitor { |
| + public: |
| + Monitor(); |
| + virtual ~Monitor(); |
| + |
| + // Returns the monitor's bounds in gfx::Screen's coordinates. |
| + virtual Rect GetBounds() const = 0; |
| + |
| + // Returns the monitor's work area in gfx::Screen's coordinates. |
| + virtual Rect GetWorkArea() const = 0; |
| + |
| + // Output device's pixel scale factor. This specifies how much the |
| + // UI should be scaled when the actual output has more pixels than |
| + // standard monitors (which is around 100~120dpi.) For aura, this |
|
Ben Goodger (Google)
2012/04/10 16:37:20
don't mention aura here, just note that the return
oshima
2012/04/10 21:31:46
Done.
|
| + // value is either 1.0 or 2.0, but may return different values on |
| + // other platforms. |
| + virtual float GetDeviceScaleFactor() const = 0; |
| + |
| + // Utility functions that just return the size of monitor and |
| + // work area. |
| + Size GetSize() const; |
| + Size GetWorkAreaSize() const; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Monitor); |
| +}; |
| + |
| +// Simple monitor class that stores bounds and workarea. |
| +class UI_EXPORT SimpleMonitor : public Monitor { |
| + public: |
| + SimpleMonitor(); |
| + explicit SimpleMonitor(const gfx::Rect& bounds); |
| + virtual ~SimpleMonitor(); |
| + |
| + void set_bounds(const Rect& bounds) { bounds_ = bounds; } |
| + void set_work_area(const Rect& work_area) { work_area_ = work_area; } |
| + |
| + // Monitor overrides: |
| + virtual Rect GetBounds() const OVERRIDE; |
| + virtual Rect GetWorkArea() const OVERRIDE; |
| + virtual float GetDeviceScaleFactor() const OVERRIDE; |
| + |
| + private: |
| + Rect bounds_; |
| + Rect work_area_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SimpleMonitor); |
| +}; |
| + |
| +} // namespace gfx |
| + |
| +#endif // UI_GFX_MONITOR_H_ |