diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 22:14:11 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 22:14:11 +0000 |
commit | fecec563479589b3649b1283f8b7d0662704f12b (patch) | |
tree | 4c391b6b9dbb886644de5ad7f9aa2f5941508779 /chrome/common/native_window_notification_source.h | |
parent | d8ab621fc2ed73e4e23ad534a3b896f269b66ac6 (diff) | |
download | chromium_src-fecec563479589b3649b1283f8b7d0662704f12b.zip chromium_src-fecec563479589b3649b1283f8b7d0662704f12b.tar.gz chromium_src-fecec563479589b3649b1283f8b7d0662704f12b.tar.bz2 |
Allow Source<T> and Details<T> to be instantiated with T = const Foo.
Review URL: http://codereview.chromium.org/118185
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17550 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/native_window_notification_source.h')
-rw-r--r-- | chrome/common/native_window_notification_source.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/chrome/common/native_window_notification_source.h b/chrome/common/native_window_notification_source.h index 3db7e50..1cb270d 100644 --- a/chrome/common/native_window_notification_source.h +++ b/chrome/common/native_window_notification_source.h @@ -8,8 +8,10 @@ #include "base/gfx/native_widget_types.h" #include "chrome/common/notification_source.h" -// Specialization of the Source class for HWND. This is needed as the Source -// class expects a pointer type. +// Specialization of the Source class for native windows. On Windows, these are +// HWNDs rather than pointers, and since the Source class expects a pointer +// type, this is necessary. On Mac/Linux, these are pointers, so this is +// unnecessary but harmless. template<> class Source<gfx::NativeWindow> : public NotificationSource { public: @@ -19,7 +21,9 @@ class Source<gfx::NativeWindow> : public NotificationSource { : NotificationSource(other) {} gfx::NativeWindow operator->() const { return ptr(); } - gfx::NativeWindow ptr() const { return static_cast<gfx::NativeWindow>(ptr_); } + gfx::NativeWindow ptr() const { + return static_cast<gfx::NativeWindow>(const_cast<void*>(ptr_)); + } }; #endif // CHROME_COMMON_NATIVE_WINDOW_NOTIFICATION_SOURCE_H_ |