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 defines the type used to provide details for NotificationService | 5 // This file defines the type used to provide details for NotificationService |
6 // notifications. | 6 // notifications. |
7 | 7 |
8 #ifndef CONTENT_COMMON_NOTIFICATION_DETAILS_H_ | 8 #ifndef CONTENT_COMMON_NOTIFICATION_DETAILS_H_ |
9 #define CONTENT_COMMON_NOTIFICATION_DETAILS_H_ | 9 #define CONTENT_COMMON_NOTIFICATION_DETAILS_H_ |
10 #pragma once | 10 #pragma once |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "content/common/content_export.h" |
13 | 14 |
14 // Do not declare a NotificationDetails directly--use either | 15 // Do not declare a NotificationDetails directly--use either |
15 // "Details<detailsclassname>(detailsclasspointer)" or | 16 // "Details<detailsclassname>(detailsclasspointer)" or |
16 // NotificationService::NoDetails(). | 17 // NotificationService::NoDetails(). |
17 class NotificationDetails { | 18 class CONTENT_EXPORT NotificationDetails { |
18 public: | 19 public: |
19 NotificationDetails(); | 20 NotificationDetails(); |
20 NotificationDetails(const NotificationDetails& other); | 21 NotificationDetails(const NotificationDetails& other); |
21 ~NotificationDetails(); | 22 ~NotificationDetails(); |
22 | 23 |
23 // NotificationDetails can be used as the index for a map; this method | 24 // NotificationDetails can be used as the index for a map; this method |
24 // returns the pointer to the current details as an identifier, for use as a | 25 // returns the pointer to the current details as an identifier, for use as a |
25 // map index. | 26 // map index. |
26 uintptr_t map_key() const { return reinterpret_cast<uintptr_t>(ptr_); } | 27 uintptr_t map_key() const { return reinterpret_cast<uintptr_t>(ptr_); } |
27 | 28 |
(...skipping 20 matching lines...) Expand all Loading... |
48 Details(T* ptr) : NotificationDetails(ptr) {} // NOLINT | 49 Details(T* ptr) : NotificationDetails(ptr) {} // NOLINT |
49 Details(const NotificationDetails& other) // NOLINT | 50 Details(const NotificationDetails& other) // NOLINT |
50 : NotificationDetails(other) {} | 51 : NotificationDetails(other) {} |
51 | 52 |
52 T* operator->() const { return ptr(); } | 53 T* operator->() const { return ptr(); } |
53 // The casts here allow this to compile with both T = Foo and T = const Foo. | 54 // The casts here allow this to compile with both T = Foo and T = const Foo. |
54 T* ptr() const { return static_cast<T*>(const_cast<void*>(ptr_)); } | 55 T* ptr() const { return static_cast<T*>(const_cast<void*>(ptr_)); } |
55 }; | 56 }; |
56 | 57 |
57 #endif // CONTENT_COMMON_NOTIFICATION_DETAILS_H_ | 58 #endif // CONTENT_COMMON_NOTIFICATION_DETAILS_H_ |
OLD | NEW |