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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_NATIVE_WINDOW_NOTIFICATION_SOURCE_H_
6 #define CHROME_BROWSER_NATIVE_WINDOW_NOTIFICATION_SOURCE_H_
8 #include "content/public/browser/notification_source.h"
9 #include "ui/gfx/native_widget_types.h"
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.
18 class Source
<gfx::NativeWindow
> : public content::NotificationSource
{
20 explicit Source(gfx::NativeWindow wnd
) : content::NotificationSource(wnd
) {}
22 explicit Source(const content::NotificationSource
& other
)
23 : content::NotificationSource(other
) {}
25 gfx::NativeWindow
operator->() const { return ptr(); }
26 gfx::NativeWindow
ptr() const {
27 return static_cast<gfx::NativeWindow
>(const_cast<void*>(ptr_
));
33 #endif // CHROME_BROWSER_NATIVE_WINDOW_NOTIFICATION_SOURCE_H_