OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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_NOTIFICATIONS_NOTIFICATION_BRIDGE_H_ | |
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_BRIDGE_H_ | |
7 | |
8 #include <set> | |
9 #include <string> | |
10 | |
11 #include "base/macros.h" | |
12 | |
13 class Notification; | |
14 | |
15 // Provides the low-level interface that enables notifications to be displayed | |
16 // and interacted with on the user's screen, orthogonal of whether this | |
17 // functionality is provided by the browser or by the operating system. | |
18 // TODO(miguelg): Add support for click and close events. | |
19 class NotificationBridge { | |
Peter Beverloo
2016/04/20 17:34:08
Sorry for the bike-shedding, but what do you think
| |
20 public: | |
21 static NotificationBridge* Create(); | |
22 | |
23 virtual ~NotificationBridge() {} | |
24 | |
25 // Shows a toast on screen using the data passed in |notification|. | |
26 virtual void Display(const std::string& notification_id, | |
27 const std::string& profile_id, | |
28 bool is_incognito, | |
29 const Notification& notification) = 0; | |
30 | |
31 // Closes a nofication with |notification_id| and |profile_id| if being | |
32 // displayed. | |
33 virtual void Close(const std::string& profile_id, | |
34 const std::string& notification_id) = 0; | |
35 | |
36 // Fills in |notifications| with a set of notification ids currently being | |
37 // displayed for a given profile. | |
38 // The return value expresses whether the underlying platform has the | |
39 // capability to provide displayed notifications so the empty set | |
40 // can be disambiguated. | |
41 virtual bool GetDisplayed(const std::string& profile_id, | |
42 bool incognito, | |
43 std::set<std::string>* notification_ids) const = 0; | |
44 | |
45 // Temporary method while the refactor is finished. It denotes whether | |
46 // the notifications will be shown by chrome itself or by the OS. | |
47 // It is needed while migrating MacOSX and Windows to their respective | |
48 // notification centers since the decision is made at runtime via flags. | |
49 virtual bool SupportsNotificationCenter() const = 0; | |
50 | |
51 protected: | |
52 NotificationBridge() {} | |
53 | |
54 private: | |
55 DISALLOW_COPY_AND_ASSIGN(NotificationBridge); | |
56 }; | |
57 | |
58 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_BRIDGE_H_ | |
OLD | NEW |