summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-13 16:36:01 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-13 16:36:01 +0000
commita69ab4dc378391cb4e72f56c0ea87837aea7eea9 (patch)
tree34f2fed1236c29c1c38157ad16d0fe6ef7ff46cf /chrome/browser/notifications
parentd971bcb9f5abfe8bc8e566cea7f85618381cb8c0 (diff)
downloadchromium_src-a69ab4dc378391cb4e72f56c0ea87837aea7eea9.zip
chromium_src-a69ab4dc378391cb4e72f56c0ea87837aea7eea9.tar.gz
chromium_src-a69ab4dc378391cb4e72f56c0ea87837aea7eea9.tar.bz2
On Mac, notifications needs the uninverted coordinate space, because we invert already within the layout code. This change puts notifications in the correct place regardless of the height of the dock.
BUG=40593 TEST=notifications on mac, with dock set to NOT auto-hide Review URL: http://codereview.chromium.org/1593017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications')
-rw-r--r--chrome/browser/notifications/balloon_collection.cc5
-rw-r--r--chrome/browser/notifications/balloon_collection_impl.h5
-rw-r--r--chrome/browser/notifications/balloon_collection_mac.mm8
3 files changed, 16 insertions, 2 deletions
diff --git a/chrome/browser/notifications/balloon_collection.cc b/chrome/browser/notifications/balloon_collection.cc
index 1aca3e2..52b25fc 100644
--- a/chrome/browser/notifications/balloon_collection.cc
+++ b/chrome/browser/notifications/balloon_collection.cc
@@ -222,10 +222,13 @@ gfx::Point BalloonCollectionImpl::Layout::NextPosition(
bool BalloonCollectionImpl::Layout::RefreshSystemMetrics() {
bool changed = false;
+#if defined(OS_MACOSX)
+ gfx::Rect new_work_area = GetMacWorkArea();
+#else
scoped_ptr<WindowSizer::MonitorInfoProvider> info_provider(
WindowSizer::CreateDefaultMonitorInfoProvider());
-
gfx::Rect new_work_area = info_provider->GetPrimaryMonitorWorkArea();
+#endif
if (!work_area_.Equals(new_work_area)) {
work_area_.SetRect(new_work_area.x(), new_work_area.y(),
new_work_area.width(), new_work_area.height());
diff --git a/chrome/browser/notifications/balloon_collection_impl.h b/chrome/browser/notifications/balloon_collection_impl.h
index 5b39f6f..1f3403a 100644
--- a/chrome/browser/notifications/balloon_collection_impl.h
+++ b/chrome/browser/notifications/balloon_collection_impl.h
@@ -111,6 +111,11 @@ class BalloonCollectionImpl : public BalloonCollection {
// Adjusts the positions of the balloons (e.g., when one is closed).
void PositionBalloons(bool is_reposition);
+#if defined(OS_MACOSX)
+ // Get the work area on Mac OS, without inverting the coordinates.
+ static gfx::Rect GetMacWorkArea();
+#endif
+
// Queue of active balloons.
typedef std::deque<Balloon*> Balloons;
Balloons balloons_;
diff --git a/chrome/browser/notifications/balloon_collection_mac.mm b/chrome/browser/notifications/balloon_collection_mac.mm
index f11fc9d..dc4172d 100644
--- a/chrome/browser/notifications/balloon_collection_mac.mm
+++ b/chrome/browser/notifications/balloon_collection_mac.mm
@@ -15,6 +15,12 @@ Balloon* BalloonCollectionImpl::MakeBalloon(const Notification& notification,
return balloon;
}
+// static
+gfx::Rect BalloonCollectionImpl::GetMacWorkArea() {
+ NSScreen* primary = [[NSScreen screens] objectAtIndex:0];
+ return gfx::Rect(NSRectToCGRect([primary visibleFrame]));
+}
+
int BalloonCollectionImpl::Layout::InterBalloonMargin() const {
return 5;
}
@@ -24,7 +30,7 @@ int BalloonCollectionImpl::Layout::HorizontalEdgeMargin() const {
}
int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const {
- return 18;
+ return 5;
}
// static