Index: chrome/browser/ui/views/balloon_collection_impl_win.h |
diff --git a/chrome/browser/ui/views/balloon_collection_impl_win.h b/chrome/browser/ui/views/balloon_collection_impl_win.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..66fc28ad68abdd20be9b09116566a0e0940b59a4 |
--- /dev/null |
+++ b/chrome/browser/ui/views/balloon_collection_impl_win.h |
@@ -0,0 +1,64 @@ |
+// Copyright (c) 2012 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_VIEWS_BALLOON_COLLECTION_IMPL_WIN_H_ |
+#define CHROME_BROWSER_UI_VIEWS_BALLOON_COLLECTION_IMPL_WIN_H_ |
+ |
+#include <set> |
+ |
+#include "chrome/browser/notifications/balloon_collection_impl.h" |
+#include "ui/message_center/message_center.h" |
+ |
+namespace extensions { |
+class Extension; |
+} |
+ |
+// Wrapper on top of ::BalloonCollectionImpl to provide integration between |
+// the Chrome notification UI and Windows notifications |
+// (ui::MessageCenterTrayHostWin). |
+class BalloonCollectionImplWin |
+ : public BalloonCollectionImpl, |
+ public message_center::MessageCenter::Delegate { |
+ public: |
+ BalloonCollectionImplWin(); |
+ virtual ~BalloonCollectionImplWin(); |
+ |
+ // Overridden from BalloonCollectionImpl. |
+ virtual void Add(const Notification& notification, |
+ Profile* profile) OVERRIDE; |
+ virtual bool HasSpace() const OVERRIDE; |
+ |
+ // Overridden from MessageCenter::Delegate. |
+ virtual void NotificationRemoved(const std::string& notification_id) OVERRIDE; |
+ virtual void DisableExtension(const std::string& notification_id) OVERRIDE; |
+ virtual void DisableNotificationsFromSource( |
+ const std::string& notification_id) OVERRIDE; |
+ virtual void ShowSettings(const std::string& notification_id) OVERRIDE; |
+ virtual void OnClicked(const std::string& notification_id) OVERRIDE; |
+ virtual void OnButtonClicked(const std::string& notification_id, |
+ int button_index) OVERRIDE; |
+ |
+ // Updates the notification's content. It uses |
+ // NotificationDelegate::id() to check the equality of notifications. |
+ // Returns true if the notification has been updated. False if |
+ // no corresponding notification is found. This will not change the |
+ // visibility of the notification. |
+ bool UpdateNotification(const Notification& notification); |
+ |
+ // On Win this behaves the same as UpdateNotification. |
+ bool UpdateAndShowNotification(const Notification& notification); |
+ |
+ protected: |
+ // Creates a new balloon. Overridable by unit tests. The caller is |
+ // responsible for freeing the pointer returned. |
+ virtual Balloon* MakeBalloon(const Notification& notification, |
+ Profile* profile) OVERRIDE; |
+ |
+ const extensions::Extension* GetBalloonExtension(Balloon* balloon); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImplWin); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_VIEWS_BALLOON_COLLECTION_IMPL_WIN_H_ |