OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/monitor_info_provider.h" |
| 6 |
| 7 #include "base/compiler_specific.h" |
| 8 #include "ui/gfx/screen.h" |
| 9 |
| 10 namespace { |
| 11 |
| 12 // This assumes a single monitor, which is currently the case. |
| 13 class MonitorInfoProviderAura : public MonitorInfoProvider { |
| 14 public: |
| 15 MonitorInfoProviderAura(); |
| 16 virtual ~MonitorInfoProviderAura(); |
| 17 |
| 18 // Overridden from MonitorInfoProvider: |
| 19 virtual gfx::Rect GetPrimaryMonitorWorkArea() const OVERRIDE; |
| 20 virtual gfx::Rect GetPrimaryMonitorBounds() const OVERRIDE; |
| 21 virtual gfx::Rect GetMonitorWorkAreaMatching( |
| 22 const gfx::Rect& match_rect) const OVERRIDE; |
| 23 virtual void UpdateWorkAreas() OVERRIDE; |
| 24 |
| 25 private: |
| 26 DISALLOW_COPY_AND_ASSIGN(MonitorInfoProviderAura); |
| 27 }; |
| 28 |
| 29 MonitorInfoProviderAura::MonitorInfoProviderAura() { |
| 30 } |
| 31 |
| 32 MonitorInfoProviderAura::~MonitorInfoProviderAura() { |
| 33 } |
| 34 |
| 35 gfx::Rect MonitorInfoProviderAura::GetPrimaryMonitorWorkArea() const { |
| 36 return gfx::Screen::GetMonitorWorkAreaNearestPoint(gfx::Point()); |
| 37 } |
| 38 |
| 39 gfx::Rect MonitorInfoProviderAura::GetPrimaryMonitorBounds() const { |
| 40 return gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point()); |
| 41 } |
| 42 |
| 43 gfx::Rect MonitorInfoProviderAura::GetMonitorWorkAreaMatching( |
| 44 const gfx::Rect& match_rect) const { |
| 45 return gfx::Screen::GetMonitorWorkAreaNearestPoint(gfx::Point()); |
| 46 } |
| 47 |
| 48 void MonitorInfoProviderAura::UpdateWorkAreas() { |
| 49 work_areas_.clear(); |
| 50 work_areas_.push_back(GetPrimaryMonitorBounds()); |
| 51 } |
| 52 |
| 53 } // namespace |
| 54 |
| 55 // static |
| 56 MonitorInfoProvider* MonitorInfoProvider::Create() { |
| 57 return new MonitorInfoProviderAura(); |
| 58 } |
OLD | NEW |