| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file describes a central switchboard for notifications that might | 5 // This file describes a central switchboard for notifications that might |
| 6 // happen in various parts of the application, and allows users to register | 6 // happen in various parts of the application, and allows users to register |
| 7 // observers for various classes of events that they're interested in. | 7 // observers for various classes of events that they're interested in. |
| 8 | 8 |
| 9 #ifndef CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_H_ | 9 #ifndef CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_H_ |
| 10 #define CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_H_ | 10 #define CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_H_ |
| 11 #pragma once | 11 #pragma once |
| 12 | 12 |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/notification_details.h" | 14 #include "content/public/browser/notification_details.h" |
| 15 #include "content/public/browser/notification_source.h" | 15 #include "content/public/browser/notification_source.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class CONTENT_EXPORT NotificationService { | 19 class CONTENT_EXPORT NotificationService { |
| 20 public: | 20 public: |
| 21 // Returns the NotificationService object for the current thread, or NULL if | 21 // Returns the NotificationService object for the current thread, or NULL if |
| 22 // none. | 22 // none. |
| 23 static NotificationService* current(); | 23 static NotificationService* current(); |
| 24 | 24 |
| 25 static NotificationService* Create(); |
| 26 |
| 25 virtual ~NotificationService() {} | 27 virtual ~NotificationService() {} |
| 26 | 28 |
| 27 // Synchronously posts a notification to all interested observers. | 29 // Synchronously posts a notification to all interested observers. |
| 28 // Source is a reference to a NotificationSource object representing | 30 // Source is a reference to a NotificationSource object representing |
| 29 // the object originating the notification (can be | 31 // the object originating the notification (can be |
| 30 // NotificationService::AllSources(), in which case | 32 // NotificationService::AllSources(), in which case |
| 31 // only observers interested in all sources will be notified). | 33 // only observers interested in all sources will be notified). |
| 32 // Details is a reference to an object containing additional data about | 34 // Details is a reference to an object containing additional data about |
| 33 // the notification. If no additional data is needed, NoDetails() is used. | 35 // the notification. If no additional data is needed, NoDetails() is used. |
| 34 // There is no particular order in which the observers will be notified. | 36 // There is no particular order in which the observers will be notified. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 55 } | 57 } |
| 56 | 58 |
| 57 // Returns a NotificationDetails object that represents a lack of details | 59 // Returns a NotificationDetails object that represents a lack of details |
| 58 // associated with a notification. (This is effectively a null pointer.) | 60 // associated with a notification. (This is effectively a null pointer.) |
| 59 static Details<void> NoDetails() { return Details<void>(NULL); } | 61 static Details<void> NoDetails() { return Details<void>(NULL); } |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 } // namespace content | 64 } // namespace content |
| 63 | 65 |
| 64 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_H_ | 66 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_H_ |
| OLD | NEW |