summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-09 23:16:56 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-09 23:16:56 +0000
commit6a760c99f8a9590f8643a832d50980c60c5c3931 (patch)
tree24cc61cdac8f30b937fe6c39ff342a142835c4c1 /chrome/browser/notifications
parent751fae0d3da720758f736b515012e72ce0a1e7e7 (diff)
downloadchromium_src-6a760c99f8a9590f8643a832d50980c60c5c3931.zip
chromium_src-6a760c99f8a9590f8643a832d50980c60c5c3931.tar.gz
chromium_src-6a760c99f8a9590f8643a832d50980c60c5c3931.tar.bz2
Desktop Notifications for the mac
BUG=23066 TEST=notify_demo.html Review URL: http://codereview.chromium.org/548208 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38533 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications')
-rw-r--r--chrome/browser/notifications/balloon_collection.cc6
-rw-r--r--chrome/browser/notifications/balloon_collection_mac.mm8
-rw-r--r--chrome/browser/notifications/notification_object_proxy.cc9
3 files changed, 19 insertions, 4 deletions
diff --git a/chrome/browser/notifications/balloon_collection.cc b/chrome/browser/notifications/balloon_collection.cc
index 224e7bb..58b0f31 100644
--- a/chrome/browser/notifications/balloon_collection.cc
+++ b/chrome/browser/notifications/balloon_collection.cc
@@ -29,9 +29,15 @@ const int kInterBalloonMargin = 5;
} // namespace
// static
+#if defined(OS_MACOSX)
+BalloonCollectionImpl::Layout::Placement
+ BalloonCollectionImpl::Layout::placement_ =
+ Layout::VERTICALLY_FROM_TOP_RIGHT;
+#else
BalloonCollectionImpl::Layout::Placement
BalloonCollectionImpl::Layout::placement_ =
Layout::VERTICALLY_FROM_BOTTOM_RIGHT;
+#endif
BalloonCollectionImpl::BalloonCollectionImpl()
: space_change_listener_(NULL) {
diff --git a/chrome/browser/notifications/balloon_collection_mac.mm b/chrome/browser/notifications/balloon_collection_mac.mm
index 6a652e0..4e8e305 100644
--- a/chrome/browser/notifications/balloon_collection_mac.mm
+++ b/chrome/browser/notifications/balloon_collection_mac.mm
@@ -3,12 +3,16 @@
// found in the LICENSE file.
#include "chrome/browser/notifications/balloon_collection.h"
+#include "chrome/browser/cocoa/notifications/balloon_view_bridge.h"
#include "base/logging.h"
Balloon* BalloonCollectionImpl::MakeBalloon(const Notification& notification,
Profile* profile) {
- // TODO(johnnyg): http://crbug.com/23066. Hook up to views.
- return new Balloon(notification, profile, this);
+ Balloon* balloon = new Balloon(notification, profile, this);
+ balloon->set_view(new BalloonViewBridge());
+ gfx::Size size(layout_.min_balloon_width(), layout_.min_balloon_height());
+ balloon->set_content_size(size);
+ return balloon;
}
diff --git a/chrome/browser/notifications/notification_object_proxy.cc b/chrome/browser/notifications/notification_object_proxy.cc
index a18e0d7..3b45ddf 100644
--- a/chrome/browser/notifications/notification_object_proxy.cc
+++ b/chrome/browser/notifications/notification_object_proxy.cc
@@ -59,8 +59,13 @@ void NotificationObjectProxy::DeliverMessage(IPC::Message* message) {
// Deferred method which runs on the IO thread and sends a message to the
// proxied notification, routing it through the correct host in the browser.
void NotificationObjectProxy::Send(IPC::Message* message) {
+ // Take ownership of the message; ownership will pass to a host if possible.
+ scoped_ptr<IPC::Message> owned_message(message);
+
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
- if (host)
- host->Send(message);
+ if (host) {
+ // Pass ownership to the host.
+ host->Send(owned_message.release());
+ }
}