summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-19 14:11:09 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-19 14:11:09 +0000
commit4def0e69084b16e3920ed095a4fcb197565a6d1f (patch)
treec1f933916c0a63a22228f24bdb818d5901faea4b /chrome/browser/ui
parentbe9324e03918d6c0591c844cd1a7a4d7b8f45452 (diff)
downloadchromium_src-4def0e69084b16e3920ed095a4fcb197565a6d1f.zip
chromium_src-4def0e69084b16e3920ed095a4fcb197565a6d1f.tar.gz
chromium_src-4def0e69084b16e3920ed095a4fcb197565a6d1f.tar.bz2
Gets ScreenAura to correctly calculate work area, and hooks
WindowSizer up to it. Also removes window_sizer_win when building aura as we shouldn't be using it with aura. Lastly I had to add AURA_EXPORT to the FocusManager as visual studio doesn't like it when you try to export a class that inherits from a non-exported class. BUG=none TEST=none R=ben@chromium.org Review URL: http://codereview.chromium.org/8346026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106279 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/window_sizer.h5
-rw-r--r--chrome/browser/ui/window_sizer_aura.cc41
-rw-r--r--chrome/browser/ui/window_sizer_gtk.cc8
-rw-r--r--chrome/browser/ui/window_sizer_mac.mm10
-rw-r--r--chrome/browser/ui/window_sizer_unittest.cc20
-rw-r--r--chrome/browser/ui/window_sizer_win.cc11
6 files changed, 25 insertions, 70 deletions
diff --git a/chrome/browser/ui/window_sizer.h b/chrome/browser/ui/window_sizer.h
index 7b21cdc..cf57e37 100644
--- a/chrome/browser/ui/window_sizer.h
+++ b/chrome/browser/ui/window_sizer.h
@@ -56,11 +56,6 @@ class WindowSizer {
virtual gfx::Rect GetMonitorWorkAreaMatching(
const gfx::Rect& match_rect) const = 0;
- // Returns the delta between the work area and the monitor bounds for the
- // monitor that most closely intersects the provided bounds.
- virtual gfx::Point GetBoundsOffsetMatching(
- 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.
diff --git a/chrome/browser/ui/window_sizer_aura.cc b/chrome/browser/ui/window_sizer_aura.cc
index e4e8d53..c8d313b 100644
--- a/chrome/browser/ui/window_sizer_aura.cc
+++ b/chrome/browser/ui/window_sizer_aura.cc
@@ -4,47 +4,38 @@
#include "chrome/browser/ui/window_sizer.h"
-#include "ui/aura/desktop.h"
-#include "ui/aura/window.h"
+#include "base/compiler_specific.h"
#include "ui/gfx/screen.h"
-// TODO(oshima): Get This from WindowManager
+// This doesn't matter for aura, which has different tiling.
+// static
const int WindowSizer::kWindowTilePixels = 10;
-// An implementation of WindowSizer::MonitorInfoProvider that gets the actual
-// monitor information from X via GDK.
+// An implementation of WindowSizer::MonitorInfoProvider. This assumes a single
+// monitor, which is currently the case.
class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider {
public:
- DefaultMonitorInfoProvider() { }
+ DefaultMonitorInfoProvider() {}
- virtual gfx::Rect GetPrimaryMonitorWorkArea() const {
- return gfx::Screen::GetMonitorWorkAreaNearestPoint(
- gfx::Point(0, 0));
+ virtual gfx::Rect GetPrimaryMonitorWorkArea() const OVERRIDE {
+ return gfx::Screen::GetMonitorWorkAreaNearestPoint(gfx::Point());
}
- virtual gfx::Rect GetPrimaryMonitorBounds() const {
- aura::Desktop* desktop = aura::Desktop::GetInstance();
- return gfx::Rect(desktop->GetHostSize());
+ virtual gfx::Rect GetPrimaryMonitorBounds() const OVERRIDE {
+ return gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point());
}
virtual gfx::Rect GetMonitorWorkAreaMatching(
- const gfx::Rect& match_rect) const {
- return gfx::Screen::GetMonitorWorkAreaNearestPoint(
- match_rect.origin());
- }
-
- virtual gfx::Point GetBoundsOffsetMatching(
- const gfx::Rect& match_rect) const {
- return GetMonitorWorkAreaMatching(match_rect).origin();
+ const gfx::Rect& match_rect) const OVERRIDE {
+ return gfx::Screen::GetMonitorWorkAreaNearestPoint(gfx::Point());
}
- void UpdateWorkAreas() {
+ virtual void UpdateWorkAreas() OVERRIDE {
work_areas_.clear();
work_areas_.push_back(GetPrimaryMonitorBounds());
}
private:
-
DISALLOW_COPY_AND_ASSIGN(DefaultMonitorInfoProvider);
};
@@ -56,9 +47,7 @@ WindowSizer::CreateDefaultMonitorInfoProvider() {
// static
gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size) {
- // TODO(oshima):This is used to control panel/popups, and this may
- // not be needed on aura environment as they must be controlled by
- // WM.
- NOTIMPLEMENTED();
+ // TODO(oshima):This is used to control panel/popups, and this may not be
+ // needed on aura environment as they must be controlled by WM.
return gfx::Point();
}
diff --git a/chrome/browser/ui/window_sizer_gtk.cc b/chrome/browser/ui/window_sizer_gtk.cc
index 2d2dff6..6746eea 100644
--- a/chrome/browser/ui/window_sizer_gtk.cc
+++ b/chrome/browser/ui/window_sizer_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -45,12 +45,6 @@ class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider {
return GetPrimaryMonitorWorkArea();
}
- virtual gfx::Point GetBoundsOffsetMatching(
- const gfx::Rect& match_rect) const {
- // TODO(thestig) Implement multi-monitor support.
- return GetPrimaryMonitorWorkArea().origin();
- }
-
void UpdateWorkAreas() {
// TODO(thestig) Implement multi-monitor support.
work_areas_.clear();
diff --git a/chrome/browser/ui/window_sizer_mac.mm b/chrome/browser/ui/window_sizer_mac.mm
index 5d1bb66..56cf887 100644
--- a/chrome/browser/ui/window_sizer_mac.mm
+++ b/chrome/browser/ui/window_sizer_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -47,14 +47,6 @@ class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider {
return ConvertCoordinateSystem([match_screen visibleFrame]);
}
- virtual gfx::Point GetBoundsOffsetMatching(
- const gfx::Rect& match_rect) const {
- NSScreen* match_screen = GetMatchingScreen(match_rect);
- gfx::Rect bounds = ConvertCoordinateSystem([match_screen frame]);
- gfx::Rect work_area = ConvertCoordinateSystem([match_screen visibleFrame]);
- return gfx::Point(work_area.x() - bounds.x(), work_area.y() - bounds.y());
- }
-
virtual void UpdateWorkAreas();
private:
diff --git a/chrome/browser/ui/window_sizer_unittest.cc b/chrome/browser/ui/window_sizer_unittest.cc
index 22410f0..8532e74 100644
--- a/chrome/browser/ui/window_sizer_unittest.cc
+++ b/chrome/browser/ui/window_sizer_unittest.cc
@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/window_sizer.h"
+
#include <vector>
-#include "chrome/browser/ui/window_sizer.h"
+#include "base/compiler_specific.h"
#include "base/logging.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -53,28 +55,20 @@ class TestMonitorInfoProvider : public WindowSizer::MonitorInfoProvider {
}
// Overridden from WindowSizer::MonitorInfoProvider:
- virtual gfx::Rect GetPrimaryMonitorWorkArea() const {
+ virtual gfx::Rect GetPrimaryMonitorWorkArea() const OVERRIDE {
return work_areas_[0];
}
- virtual gfx::Rect GetPrimaryMonitorBounds() const {
+ virtual gfx::Rect GetPrimaryMonitorBounds() const OVERRIDE {
return monitor_bounds_[0];
}
virtual gfx::Rect GetMonitorWorkAreaMatching(
- const gfx::Rect& match_rect) const {
+ const gfx::Rect& match_rect) const OVERRIDE {
return work_areas_[GetMonitorIndexMatchingBounds(match_rect)];
}
- virtual gfx::Point GetBoundsOffsetMatching(
- const gfx::Rect& match_rect) const {
- int monitor_index = GetMonitorIndexMatchingBounds(match_rect);
- gfx::Rect bounds = monitor_bounds_[monitor_index];
- const gfx::Rect& work_area = work_areas_[monitor_index];
- return gfx::Point(work_area.x() - bounds.x(), work_area.y() - bounds.y());
- }
-
- virtual void UpdateWorkAreas() { }
+ virtual void UpdateWorkAreas() OVERRIDE {}
private:
size_t GetMonitorIndexMatchingBounds(const gfx::Rect& match_rect) const {
diff --git a/chrome/browser/ui/window_sizer_win.cc b/chrome/browser/ui/window_sizer_win.cc
index a2952a40..9a4fa37 100644
--- a/chrome/browser/ui/window_sizer_win.cc
+++ b/chrome/browser/ui/window_sizer_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -37,15 +37,6 @@ class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider {
return gfx::Rect(monitor_info.rcWork);
}
- virtual gfx::Point GetBoundsOffsetMatching(
- const gfx::Rect& match_rect) const {
- RECT other_bounds_rect = match_rect.ToRECT();
- MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect(
- &other_bounds_rect, MONITOR_DEFAULTTONEAREST));
- return gfx::Point(monitor_info.rcWork.left - monitor_info.rcMonitor.left,
- monitor_info.rcWork.top - monitor_info.rcMonitor.top);
- }
-
void UpdateWorkAreas() {
work_areas_.clear();
EnumDisplayMonitors(NULL, NULL,