OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
16 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
17 #include "chrome/browser/notifications/notification.h" | 18 #include "chrome/browser/notifications/notification.h" |
18 #include "content/public/browser/platform_notification_service.h" | 19 #include "content/public/browser/platform_notification_service.h" |
19 #include "content/public/common/persistent_notification_status.h" | 20 #include "content/public/common/persistent_notification_status.h" |
20 | 21 |
21 class NotificationDelegate; | 22 class NotificationDelegate; |
22 class NotificationUIManager; | 23 class NotificationUIManager; |
23 class Profile; | 24 class Profile; |
24 | 25 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 NotificationDelegate* delegate) const; | 119 NotificationDelegate* delegate) const; |
119 | 120 |
120 // Overrides the Notification UI Manager to use to |manager|. Only to be | 121 // Overrides the Notification UI Manager to use to |manager|. Only to be |
121 // used by tests. Tests are responsible for cleaning up after themselves. | 122 // used by tests. Tests are responsible for cleaning up after themselves. |
122 void SetNotificationUIManagerForTesting(NotificationUIManager* manager); | 123 void SetNotificationUIManagerForTesting(NotificationUIManager* manager); |
123 | 124 |
124 // Returns a display name for an origin, to be used in the context message | 125 // Returns a display name for an origin, to be used in the context message |
125 base::string16 DisplayNameForContextMessage(Profile* profile, | 126 base::string16 DisplayNameForContextMessage(Profile* profile, |
126 const GURL& origin) const; | 127 const GURL& origin) const; |
127 | 128 |
| 129 // Platforms that display native notification interact with them through this |
| 130 // object. |
| 131 scoped_ptr<NotificationUIManager> native_notification_ui_manager_; |
| 132 |
128 // Weak reference. Ownership maintains with the test. | 133 // Weak reference. Ownership maintains with the test. |
129 NotificationUIManager* notification_ui_manager_for_tests_; | 134 NotificationUIManager* notification_ui_manager_for_tests_; |
130 | 135 |
131 // Mapping between a persistent notification id and the id of the associated | 136 // Mapping between a persistent notification id and the id of the associated |
132 // message_center::Notification object. Must only be used on the UI thread. | 137 // message_center::Notification object. Must only be used on the UI thread. |
133 std::map<int64_t, std::string> persistent_notifications_; | 138 std::map<int64_t, std::string> persistent_notifications_; |
134 | 139 |
135 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); | 140 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); |
136 }; | 141 }; |
137 | 142 |
138 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 143 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
OLD | NEW |