Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome/browser/ui/views/balloon_collection_impl_win.h

Issue 11819048: Implement message center on Windows (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase on master @fa1d2262 and rearrange dependencies. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_COLLECTION_IMPL_ASH_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_BALLOON_COLLECTION_IMPL_WIN_H_
6 #define CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_COLLECTION_IMPL_ASH_H_ 6 #define CHROME_BROWSER_UI_VIEWS_BALLOON_COLLECTION_IMPL_WIN_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" / / MessageCallback
11 #include "chrome/browser/notifications/balloon_collection_impl.h" 10 #include "chrome/browser/notifications/balloon_collection_impl.h"
12 #include "ui/message_center/message_center.h" 11 #include "ui/message_center/message_center.h"
13 12
13 namespace extensions {
14 class Extension;
15 }
16
14 // Wrapper on top of ::BalloonCollectionImpl to provide integration between 17 // Wrapper on top of ::BalloonCollectionImpl to provide integration between
15 // the Chrome notification UI and Ash notifications (ash::WebNotificationTray). 18 // the Chrome notification UI and Windows notifications
16 class BalloonCollectionImplAsh 19 // (ui::MessageCenterTrayHostWin).
20 class BalloonCollectionImplWin
17 : public BalloonCollectionImpl, 21 : public BalloonCollectionImpl,
18 public message_center::MessageCenter::Delegate { 22 public message_center::MessageCenter::Delegate {
19 public: 23 public:
20 BalloonCollectionImplAsh(); 24 BalloonCollectionImplWin();
21 virtual ~BalloonCollectionImplAsh(); 25 virtual ~BalloonCollectionImplWin();
22 26
23 // Overridden from BalloonCollectionImpl. 27 // Overridden from BalloonCollectionImpl.
24 virtual void Add(const Notification& notification, 28 virtual void Add(const Notification& notification,
25 Profile* profile) OVERRIDE; 29 Profile* profile) OVERRIDE;
26 virtual bool HasSpace() const OVERRIDE; 30 virtual bool HasSpace() const OVERRIDE;
27 31
28 // Overridden from MessageCenter::Delegate. 32 // Overridden from MessageCenter::Delegate.
29 virtual void NotificationRemoved(const std::string& notification_id) OVERRIDE; 33 virtual void NotificationRemoved(const std::string& notification_id) OVERRIDE;
30 virtual void DisableExtension(const std::string& notification_id) OVERRIDE; 34 virtual void DisableExtension(const std::string& notification_id) OVERRIDE;
31 virtual void DisableNotificationsFromSource( 35 virtual void DisableNotificationsFromSource(
32 const std::string& notification_id) OVERRIDE; 36 const std::string& notification_id) OVERRIDE;
33 virtual void ShowSettings(const std::string& notification_id) OVERRIDE; 37 virtual void ShowSettings(const std::string& notification_id) OVERRIDE;
34 virtual void OnClicked(const std::string& notification_id) OVERRIDE; 38 virtual void OnClicked(const std::string& notification_id) OVERRIDE;
35 virtual void OnButtonClicked(const std::string& notification_id, 39 virtual void OnButtonClicked(const std::string& notification_id,
36 int button_index) OVERRIDE; 40 int button_index) OVERRIDE;
37 41
38 // Adds a callback for WebUI message. Returns true if the callback
39 // is succssfully registered, or false otherwise. It fails to add if
40 // there is no notification that matches NotificationDelegate::id(),
41 // or a callback for given message already exists. The callback
42 // object is owned and deleted by callee.
43 bool AddWebUIMessageCallback(
44 const Notification& notification,
45 const std::string& message,
46 const chromeos::BalloonViewHost::MessageCallback& callback);
47
48 // Updates the notification's content. It uses 42 // Updates the notification's content. It uses
49 // NotificationDelegate::id() to check the equality of notifications. 43 // NotificationDelegate::id() to check the equality of notifications.
50 // Returns true if the notification has been updated. False if 44 // Returns true if the notification has been updated. False if
51 // no corresponding notification is found. This will not change the 45 // no corresponding notification is found. This will not change the
52 // visibility of the notification. 46 // visibility of the notification.
53 bool UpdateNotification(const Notification& notification); 47 bool UpdateNotification(const Notification& notification);
54 48
55 // On Ash this behaves the same as UpdateNotification. 49 // On Win this behaves the same as UpdateNotification.
56 bool UpdateAndShowNotification(const Notification& notification); 50 bool UpdateAndShowNotification(const Notification& notification);
57 51
58 protected: 52 protected:
59 // Creates a new balloon. Overridable by unit tests. The caller is 53 // Creates a new balloon. Overridable by unit tests. The caller is
60 // responsible for freeing the pointer returned. 54 // responsible for freeing the pointer returned.
61 virtual Balloon* MakeBalloon(const Notification& notification, 55 virtual Balloon* MakeBalloon(const Notification& notification,
62 Profile* profile) OVERRIDE; 56 Profile* profile) OVERRIDE;
63 57
64 const extensions::Extension* GetBalloonExtension(Balloon* balloon); 58 const extensions::Extension* GetBalloonExtension(Balloon* balloon);
65 59
66 private: 60 private:
67 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImplAsh); 61 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImplWin);
68 }; 62 };
69 63
70 #endif // CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_COLLECTION_IMPL_ASH_H_ 64 #endif // CHROME_BROWSER_UI_VIEWS_BALLOON_COLLECTION_IMPL_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698