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

Unified Diff: chrome/browser/ui/monitor_info_provider.h

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.h
diff --git a/chrome/browser/ui/monitor_info_provider.h b/chrome/browser/ui/monitor_info_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..f28d5c021fafc4e1fe25a954550c420a2bd71df0
--- /dev/null
+++ b/chrome/browser/ui/monitor_info_provider.h
@@ -0,0 +1,59 @@
+// 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.
+
+#ifndef CHROME_BROWSER_UI_MONITOR_INFO_PROVIDER_H_
+#define CHROME_BROWSER_UI_MONITOR_INFO_PROVIDER_H_
+#pragma once
+
+#include <stddef.h>
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "ui/gfx/rect.h"
+
+// An interface implemented by an object that can retrieve information about
+// the monitors on the system.
+class MonitorInfoProvider {
Ben Goodger (Google) 2011/12/02 17:10:32 So, I actually think we can get rid of this class
tfarina 2011/12/02 17:24:43 This is crbug.com/101507
+ public:
+ // Creates an appropriate MonitorInfoProvider for the platform.
+ // The returned object is owned by the caller.
+ static MonitorInfoProvider* Create();
+
+ MonitorInfoProvider();
+ virtual ~MonitorInfoProvider();
+
+ // Returns the bounds of the work area of the primary monitor.
+ virtual gfx::Rect GetPrimaryMonitorWorkArea() const = 0;
+
+ // Returns the bounds of the primary monitor.
+ virtual gfx::Rect GetPrimaryMonitorBounds() const = 0;
+
+ // Returns the bounds of the work area of the monitor that most closely
+ // intersects the provided bounds.
+ virtual gfx::Rect GetMonitorWorkAreaMatching(
+ const gfx::Rect& match_rect) const = 0;
+
+ // Ensures number and coordinates of work areas are up-to-date. You must
+ // call this before calling either of the below functions, as work areas can
+ // change while the program is running.
+ virtual void UpdateWorkAreas() = 0;
Ben Goodger (Google) 2011/12/02 17:10:32 As far as I can tell, this function is never calle
tfarina 2011/12/02 17:24:43 Removed.
+
+ // Returns the number of monitors on the system.
+ size_t GetMonitorCount() const { return work_areas_.size(); }
Ben Goodger (Google) 2011/12/02 17:10:32 This function is only called from a function in Wi
tfarina 2011/12/02 17:24:43 Removed.
+
+ // Returns the bounds of the work area of the monitor at the specified
+ // index.
+ gfx::Rect GetWorkAreaAt(size_t index) const {
Ben Goodger (Google) 2011/12/02 17:10:32 This function is only called from a function in Wi
tfarina 2011/12/02 17:24:43 Removed.
+ return work_areas_[index];
+ }
+
+ protected:
+ std::vector<gfx::Rect> work_areas_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MonitorInfoProvider);
+};
+
+#endif // CHROME_BROWSER_UI_MONITOR_INFO_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698