Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: chrome/browser/ui/monitor_info_provider_aura.cc

Issue 8549008: Extract MonitorInfoProvider from WindowSizer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 2 Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/monitor_info_provider_aura.cc
diff --git a/chrome/browser/ui/monitor_info_provider_aura.cc b/chrome/browser/ui/monitor_info_provider_aura.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1d57d07336489ce1008150f3c912d9df3d31b80b
--- /dev/null
+++ b/chrome/browser/ui/monitor_info_provider_aura.cc
@@ -0,0 +1,58 @@
+// Copyright (c) 2011 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 "chrome/browser/ui/monitor_info_provider.h"
+
+#include "base/compiler_specific.h"
+#include "ui/gfx/screen.h"
+
+namespace {
+
+// This assumes a single monitor, which is currently the case.
+class MonitorInfoProviderAura : public MonitorInfoProvider {
+ public:
+ MonitorInfoProviderAura();
+ virtual ~MonitorInfoProviderAura();
+
+ // Overridden from MonitorInfoProvider:
+ virtual gfx::Rect GetPrimaryMonitorWorkArea() const OVERRIDE;
+ virtual gfx::Rect GetPrimaryMonitorBounds() const OVERRIDE;
+ virtual gfx::Rect GetMonitorWorkAreaMatching(
+ const gfx::Rect& match_rect) const OVERRIDE;
+ virtual void UpdateWorkAreas() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MonitorInfoProviderAura);
+};
+
+MonitorInfoProviderAura::MonitorInfoProviderAura() {
+}
+
+MonitorInfoProviderAura::~MonitorInfoProviderAura() {
+}
+
+gfx::Rect MonitorInfoProviderAura::GetPrimaryMonitorWorkArea() const {
+ return gfx::Screen::GetMonitorWorkAreaNearestPoint(gfx::Point());
+}
+
+gfx::Rect MonitorInfoProviderAura::GetPrimaryMonitorBounds() const {
+ return gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point());
+}
+
+gfx::Rect MonitorInfoProviderAura::GetMonitorWorkAreaMatching(
+ const gfx::Rect& match_rect) const {
+ return gfx::Screen::GetMonitorWorkAreaNearestPoint(gfx::Point());
+}
+
+void MonitorInfoProviderAura::UpdateWorkAreas() {
+ work_areas_.clear();
+ work_areas_.push_back(GetPrimaryMonitorBounds());
+}
+
+} // namespace
+
+// static
+MonitorInfoProvider* MonitorInfoProvider::Create() {
+ return new MonitorInfoProviderAura();
+}

Powered by Google App Engine
This is Rietveld 408576698