[email protected] | 7f070d4 | 2011-03-09 20:25:32 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 9634278 | 2009-05-23 15:24:20 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 7596aa4 | 2011-10-26 00:57:22 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_NATIVE_WINDOW_NOTIFICATION_SOURCE_H_ |
6 | #define CHROME_BROWSER_NATIVE_WINDOW_NOTIFICATION_SOURCE_H_ | ||||
[email protected] | 9634278 | 2009-05-23 15:24:20 | [diff] [blame] | 7 | |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 8 | #include "content/public/browser/notification_source.h" |
[email protected] | 08397d5 | 2011-02-05 01:53:38 | [diff] [blame] | 9 | #include "ui/gfx/native_widget_types.h" |
[email protected] | 9634278 | 2009-05-23 15:24:20 | [diff] [blame] | 10 | |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 11 | namespace content { |
12 | |||||
[email protected] | fecec563 | 2009-06-03 22:14:11 | [diff] [blame] | 13 | // Specialization of the Source class for native windows. On Windows, these are |
14 | // HWNDs rather than pointers, and since the Source class expects a pointer | ||||
15 | // type, this is necessary. On Mac/Linux, these are pointers, so this is | ||||
16 | // unnecessary but harmless. | ||||
[email protected] | 9634278 | 2009-05-23 15:24:20 | [diff] [blame] | 17 | template<> |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 18 | class Source<gfx::NativeWindow> : public content::NotificationSource { |
[email protected] | 9634278 | 2009-05-23 15:24:20 | [diff] [blame] | 19 | public: |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 20 | explicit Source(gfx::NativeWindow wnd) : content::NotificationSource(wnd) {} |
[email protected] | 9634278 | 2009-05-23 15:24:20 | [diff] [blame] | 21 | |
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 22 | explicit Source(const content::NotificationSource& other) |
23 | : content::NotificationSource(other) {} | ||||
[email protected] | 9634278 | 2009-05-23 15:24:20 | [diff] [blame] | 24 | |
[email protected] | 5c06c596 | 2009-05-26 21:29:08 | [diff] [blame] | 25 | gfx::NativeWindow operator->() const { return ptr(); } |
[email protected] | fecec563 | 2009-06-03 22:14:11 | [diff] [blame] | 26 | gfx::NativeWindow ptr() const { |
27 | return static_cast<gfx::NativeWindow>(const_cast<void*>(ptr_)); | ||||
28 | } | ||||
[email protected] | 9634278 | 2009-05-23 15:24:20 | [diff] [blame] | 29 | }; |
30 | |||||
[email protected] | 6c2381d | 2011-10-19 02:52:53 | [diff] [blame] | 31 | } |
32 | |||||
[email protected] | 7596aa4 | 2011-10-26 00:57:22 | [diff] [blame] | 33 | #endif // CHROME_BROWSER_NATIVE_WINDOW_NOTIFICATION_SOURCE_H_ |