Chromium Code Reviews| Index: chrome/browser/notifications/notification_display_service.h |
| diff --git a/chrome/browser/notifications/notification_display_service.h b/chrome/browser/notifications/notification_display_service.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..414032481bf24c3cc9adb31e52c09861df47b677 |
| --- /dev/null |
| +++ b/chrome/browser/notifications/notification_display_service.h |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2016 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_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_H_ |
| +#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_H_ |
| + |
| +#include <set> |
| +#include "base/macros.h" |
| +#include "components/keyed_service/core/keyed_service.h" |
| +#include "ui/message_center/notification.h" |
| + |
| +class Notification; |
|
Peter Beverloo
2016/03/21 15:57:04
You both include the message_center::Notification
Miguel Garcia
2016/04/11 19:51:26
Done.
|
| +class Profile; |
| + |
| +class NotificationDisplayService : public KeyedService { |
|
Peter Beverloo
2016/03/21 15:57:03
++docs
Miguel Garcia
2016/04/11 19:51:26
Done.
|
| + public: |
| + static NotificationDisplayService* Create(Profile* profile); |
|
Peter Beverloo
2016/03/21 15:57:04
Can we try to have the creation logic in Notificat
Miguel Garcia
2016/03/21 17:43:02
No, this won't work for mac because we would need
Miguel Garcia
2016/04/11 19:51:26
Reworked a bit after chatting offline, *most* of t
|
| + |
| + // Shows a toast on string using the data passed in |notification|. |
| + virtual void Display(const Notification& notification) = 0; |
|
Peter Beverloo
2016/03/21 15:57:04
Why won't we need to pass the |notification_id| he
Miguel Garcia
2016/03/21 17:43:03
Sure, originally you mentioned that the Notificati
Miguel Garcia
2016/04/11 19:51:26
Added now, this highlights how mac right now does
|
| + |
| + // Closes a nofication. Returns wether a notiication was actually closed. |
| + virtual bool Close(const std::string& notification_id) = 0; |
|
Peter Beverloo
2016/03/21 15:57:04
What are we going to use the returned boolean for?
Miguel Garcia
2016/03/21 17:43:03
I can remove it. This was something the old ui man
|
| + |
| + |
| + // Return a set of notification ids currently being displayed either as popups |
| + // or in the native platform's notification center. |
| + virtual std::set<std::string> GetDisplayed() const = 0; |
|
Peter Beverloo
2016/03/21 15:57:03
This needs some way to indicate whether the list o
Miguel Garcia
2016/03/21 17:43:02
ok
Miguel Garcia
2016/04/11 19:51:26
Done.
|
| + |
| + // Temporary method while we finish the refactor |
| + virtual bool SupportsNotificationCenter() const = 0; |
| + |
| + protected: |
|
Peter Beverloo
2016/03/21 15:57:03
What interfaces do have are virtual destructors :-
Peter Beverloo
2016/03/21 15:57:04
This is an interface, and interfaces don't have me
Miguel Garcia
2016/03/21 17:43:03
I would like to avoid having to pass and store the
Miguel Garcia
2016/03/21 17:43:03
? do, have, are?
In general keyservice destructio
Miguel Garcia
2016/04/11 19:51:26
Reluctantly added it to each subclass :(
|
| + explicit NotificationDisplayService(Profile* profile); |
| + Profile* profile_; // weak |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(NotificationDisplayService); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_H_ |