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

Side by Side Diff: chrome/browser/ui/views/ash/balloon_collection_impl_ash.h

Issue 10947046: Eliminate kAshNotifyDisabled and SystemNotification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit Created 8 years, 3 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 | Annotate | Revision Log
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_ASH_BALLOON_COLLECTION_IMPL_ASH_H_
6 #define CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_COLLECTION_IMPL_ASH_H_ 6 #define CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_COLLECTION_IMPL_ASH_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "ash/system/web_notification/web_notification_tray.h" 10 #include "ash/system/web_notification/web_notification_tray.h"
11 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" / / MessageCallback 11 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" / / MessageCallback
12 #include "chrome/browser/notifications/balloon_collection_impl.h" 12 #include "chrome/browser/notifications/balloon_collection_impl.h"
13 13
14 // Wrapper on top of ::BalloonCollectionImpl to provide an interface for 14 // Wrapper on top of ::BalloonCollectionImpl to provide integration between
15 // chromeos::SystemNotification. 15 // the Chrome notification UI and Ash notifications (ash::WebNotificationTray).
16 class BalloonCollectionImplAsh : public BalloonCollectionImpl, 16 class BalloonCollectionImplAsh : public BalloonCollectionImpl,
17 public ash::WebNotificationTray::Delegate { 17 public ash::WebNotificationTray::Delegate {
18 public: 18 public:
19 BalloonCollectionImplAsh(); 19 BalloonCollectionImplAsh();
20 virtual ~BalloonCollectionImplAsh(); 20 virtual ~BalloonCollectionImplAsh();
21 21
22 // Overridden from BalloonCollectionImpl. 22 // Overridden from BalloonCollectionImpl.
23 virtual void Add(const Notification& notification, 23 virtual void Add(const Notification& notification,
24 Profile* profile) OVERRIDE; 24 Profile* profile) OVERRIDE;
25 virtual bool HasSpace() const OVERRIDE; 25 virtual bool HasSpace() const OVERRIDE;
26 26
27 // Overridden from WebNotificationTray::Delegate. 27 // Overridden from WebNotificationTray::Delegate.
28 virtual void NotificationRemoved(const std::string& notifcation_id) OVERRIDE; 28 virtual void NotificationRemoved(const std::string& notifcation_id) OVERRIDE;
29 virtual void DisableExtension(const std::string& notifcation_id) OVERRIDE; 29 virtual void DisableExtension(const std::string& notifcation_id) OVERRIDE;
30 virtual void DisableNotificationsFromSource( 30 virtual void DisableNotificationsFromSource(
31 const std::string& notifcation_id) OVERRIDE; 31 const std::string& notifcation_id) OVERRIDE;
32 virtual void ShowSettings(const std::string& notifcation_id) OVERRIDE; 32 virtual void ShowSettings(const std::string& notifcation_id) OVERRIDE;
33 virtual void OnClicked(const std::string& notifcation_id) OVERRIDE; 33 virtual void OnClicked(const std::string& notifcation_id) OVERRIDE;
34 34
35 // Adds a callback for WebUI message. Returns true if the callback 35 // Adds a callback for WebUI message. Returns true if the callback
36 // is succssfully registered, or false otherwise. It fails to add if 36 // is succssfully registered, or false otherwise. It fails to add if
37 // there is no notification that matches NotificationDelegate::id(), 37 // there is no notification that matches NotificationDelegate::id(),
38 // or a callback for given message already exists. The callback 38 // or a callback for given message already exists. The callback
39 // object is owned and deleted by callee. 39 // object is owned and deleted by callee.
40 bool AddWebUIMessageCallback( 40 bool AddWebUIMessageCallback(
41 const Notification& notification, 41 const Notification& notification,
42 const std::string& message, 42 const std::string& message,
43 const chromeos::BalloonViewHost::MessageCallback& callback); 43 const chromeos::BalloonViewHost::MessageCallback& callback);
44 44
45 // Adds a new system notification.
46 // |sticky| is ignored in the Ash implementation; desktop notifications
47 // are always sticky (i.e. they need to be dismissed explicitly).
48 void AddSystemNotification(const Notification& notification,
49 Profile* profile,
50 bool sticky);
51
52 // Updates the notification's content. It uses 45 // Updates the notification's content. It uses
53 // NotificationDelegate::id() to check the equality of notifications. 46 // NotificationDelegate::id() to check the equality of notifications.
54 // Returns true if the notification has been updated. False if 47 // Returns true if the notification has been updated. False if
55 // no corresponding notification is found. This will not change the 48 // no corresponding notification is found. This will not change the
56 // visibility of the notification. 49 // visibility of the notification.
57 bool UpdateNotification(const Notification& notification); 50 bool UpdateNotification(const Notification& notification);
58 51
59 // On Ash this behaves the same as UpdateNotification. 52 // On Ash this behaves the same as UpdateNotification.
60 bool UpdateAndShowNotification(const Notification& notification); 53 bool UpdateAndShowNotification(const Notification& notification);
61 54
62 protected: 55 protected:
63 // Creates a new balloon. Overridable by unit tests. The caller is 56 // Creates a new balloon. Overridable by unit tests. The caller is
64 // responsible for freeing the pointer returned. 57 // responsible for freeing the pointer returned.
65 virtual Balloon* MakeBalloon(const Notification& notification, 58 virtual Balloon* MakeBalloon(const Notification& notification,
66 Profile* profile) OVERRIDE; 59 Profile* profile) OVERRIDE;
67 60
68 const extensions::Extension* GetBalloonExtension(Balloon* balloon); 61 const extensions::Extension* GetBalloonExtension(Balloon* balloon);
69 62
70 private: 63 private:
71 // Set of unique ids associated with system notifications, used by
72 // MakeBalloon to determine whether or not to enable Web UI.
73 std::set<std::string> system_notifications_;
74
75 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImplAsh); 64 DISALLOW_COPY_AND_ASSIGN(BalloonCollectionImplAsh);
76 }; 65 };
77 66
78 #endif // CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_COLLECTION_IMPL_ASH_H_ 67 #endif // CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_COLLECTION_IMPL_ASH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698