OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_BALLOON_COLLECTION_IMPL_WIN_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_BALLOON_COLLECTION_IMPL_WIN_H_ |
| 7 |
| 8 #include <set> |
| 9 |
| 10 #include "chrome/browser/notifications/balloon_collection_impl.h" |
| 11 #include "ui/message_center/message_center.h" |
| 12 |
| 13 namespace extensions { |
| 14 class Extension; |
| 15 } |
| 16 |
| 17 // Wrapper on top of ::BalloonCollectionImpl to provide integration between |
| 18 // the Chrome notification UI and Windows notifications |
| 19 // (ui::MessageCenterTrayHostWin). |
| 20 class BalloonCollectionImplWin |
| 21 : public BalloonCollectionImpl, |
| 22 public message_center::MessageCenter::Delegate { |
| 23 public: |
| 24 BalloonCollectionImplWin(); |
| 25 virtual ~BalloonCollectionImplWin(); |
| 26 |
| 27 // Overridden from BalloonCollectionImpl. |
| 28 virtual void Add(const Notification& notification, |
| 29 Profile* profile) OVERRIDE; |
| 30 virtual bool HasSpace() const OVERRIDE; |
| 31 |
| 32 // Overridden from MessageCenter::Delegate. |
| 33 virtual void NotificationRemoved(const std::string& notification_id) OVERRIDE; |
| 34 virtual void DisableExtension(const std::string& notification_id) OVERRIDE; |
| 35 virtual void DisableNotificationsFromSource( |
| 36 const std::string& notification_id) OVERRIDE; |
| 37 virtual void ShowSettings(const std::string& notification_id) OVERRIDE; |
| 38 virtual void OnClicked(const std::string& notification_id) OVERRIDE; |
| 39 virtual void OnButtonClicked(const std::string& notification_id, |
| 40 int button_index) OVERRIDE; |
| 41 |
| 42 // Updates the notification's content. It uses |
| 43 // NotificationDelegate::id() to check the equality of notifications. |
| 44 // Returns true if the notification has been updated. False if |
| 45 // no corresponding notification is found. This will not change the |
| 46 // visibility of the notification. |
| 47 bool UpdateNotification(const Notification& notification); |
| 48 |
| 49 // On Win this behaves the same as UpdateNotification. |
| 50 bool UpdateAndShowNotification(const Notification& notification); |
| 51 |
| 52 protected: |
| 53 // Creates a new balloon. Overridable by unit tests. The caller is |
| 54 // responsible for freeing the pointer returned. |
| 55 virtual Balloon* MakeBalloon(const Notification& notification, |
| 56 Profile* profile) OVERRIDE; |
| 57 |
| 58 const extensions::Extension* GetBalloonExtension(Balloon* balloon); |
| 59 |
| 60 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImplWin); |
| 62 }; |
| 63 |
| 64 #endif // CHROME_BROWSER_UI_VIEWS_BALLOON_COLLECTION_IMPL_WIN_H_ |
OLD | NEW |