summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/notifications')
-rw-r--r--chrome/browser/notifications/balloon.cc4
-rw-r--r--chrome/browser/notifications/balloon.h3
-rw-r--r--chrome/browser/notifications/balloon_host.cc4
-rw-r--r--chrome/browser/notifications/balloon_host.h2
-rw-r--r--chrome/browser/notifications/notification.h1
-rw-r--r--chrome/browser/notifications/notification_delegate.h3
-rw-r--r--chrome/browser/notifications/notification_object_proxy.cc9
-rw-r--r--chrome/browser/notifications/notification_object_proxy.h1
8 files changed, 26 insertions, 1 deletions
diff --git a/chrome/browser/notifications/balloon.cc b/chrome/browser/notifications/balloon.cc
index 969bde1..96f3fca 100644
--- a/chrome/browser/notifications/balloon.cc
+++ b/chrome/browser/notifications/balloon.cc
@@ -51,6 +51,10 @@ void Balloon::Update(const Notification& notification) {
}
}
+void Balloon::OnClick() {
+ notification_->Click();
+}
+
void Balloon::OnClose(bool by_user) {
notification_->Close(by_user);
collection_->OnBalloonClosed(this);
diff --git a/chrome/browser/notifications/balloon.h b/chrome/browser/notifications/balloon.h
index 225eca0..3f4ba0b 100644
--- a/chrome/browser/notifications/balloon.h
+++ b/chrome/browser/notifications/balloon.h
@@ -96,6 +96,9 @@ class Balloon {
// Notify that the content of notification has changed.
virtual void Update(const Notification& notification);
+ // Called when the balloon is clicked by the user.
+ virtual void OnClick();
+
// Called when the balloon is closed, either by user (through the UI)
// or by a script.
virtual void OnClose(bool by_user);
diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc
index 8e5b676..6e3b44d 100644
--- a/chrome/browser/notifications/balloon_host.cc
+++ b/chrome/browser/notifications/balloon_host.cc
@@ -123,6 +123,10 @@ void BalloonHost::UpdatePreferredSize(const gfx::Size& new_size) {
balloon_->SetContentPreferredSize(new_size);
}
+void BalloonHost::HandleMouseDown() {
+ balloon_->OnClick();
+}
+
RendererPreferences BalloonHost::GetRendererPrefs(Profile* profile) const {
RendererPreferences preferences;
renderer_preferences_util::UpdateFromSystemSettings(&preferences, profile);
diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h
index 84d9953..4211636 100644
--- a/chrome/browser/notifications/balloon_host.h
+++ b/chrome/browser/notifications/balloon_host.h
@@ -110,7 +110,7 @@ class BalloonHost : public RenderViewHostDelegate,
}
virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {}
virtual void HandleMouseMove() {}
- virtual void HandleMouseDown() {}
+ virtual void HandleMouseDown();
virtual void HandleMouseLeave() {}
virtual void UpdatePreferredSize(const gfx::Size& pref_size);
virtual RendererPreferences GetRendererPrefs(Profile* profile) const;
diff --git a/chrome/browser/notifications/notification.h b/chrome/browser/notifications/notification.h
index 49aabf2..f8ab903 100644
--- a/chrome/browser/notifications/notification.h
+++ b/chrome/browser/notifications/notification.h
@@ -57,6 +57,7 @@ class Notification {
void Display() const { delegate()->Display(); }
void Error() const { delegate()->Error(); }
+ void Click() const { delegate()->Click(); }
void Close(bool by_user) const { delegate()->Close(by_user); }
bool IsSame(const Notification& other) const {
diff --git a/chrome/browser/notifications/notification_delegate.h b/chrome/browser/notifications/notification_delegate.h
index 6814bde..53226e5 100644
--- a/chrome/browser/notifications/notification_delegate.h
+++ b/chrome/browser/notifications/notification_delegate.h
@@ -27,6 +27,9 @@ class NotificationDelegate
// user explicitly (as opposed to timeout/script), |by_user| should be true.
virtual void Close(bool by_user) = 0;
+ // To be called when a desktop notification is clicked.
+ virtual void Click() = 0;
+
// Returns unique id of the notification.
virtual std::string id() const = 0;
diff --git a/chrome/browser/notifications/notification_object_proxy.cc b/chrome/browser/notifications/notification_object_proxy.cc
index 76363e5..edf35df 100644
--- a/chrome/browser/notifications/notification_object_proxy.cc
+++ b/chrome/browser/notifications/notification_object_proxy.cc
@@ -49,6 +49,15 @@ void NotificationObjectProxy::Close(bool by_user) {
}
}
+void NotificationObjectProxy::Click() {
+ if (worker_) {
+ NOTREACHED();
+ } else {
+ DeliverMessage(new ViewMsg_PostClickToNotificationObject(
+ route_id_, notification_id_));
+ }
+}
+
std::string NotificationObjectProxy::id() const {
return StringPrintf("%d:%d:%d:%d", process_id_, route_id_,
notification_id_, worker_);
diff --git a/chrome/browser/notifications/notification_object_proxy.h b/chrome/browser/notifications/notification_object_proxy.h
index 70aa193..c3cb777 100644
--- a/chrome/browser/notifications/notification_object_proxy.h
+++ b/chrome/browser/notifications/notification_object_proxy.h
@@ -30,6 +30,7 @@ class NotificationObjectProxy
virtual void Display();
virtual void Error();
virtual void Close(bool by_user);
+ virtual void Click();
virtual std::string id() const;
protected: