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.
4
5#ifndef CHROME_BROWSER_NATIVE_WINDOW_NOTIFICATION_SOURCE_H_
6#define CHROME_BROWSER_NATIVE_WINDOW_NOTIFICATION_SOURCE_H_
7
8#include "content/public/browser/notification_source.h"
9#include "ui/gfx/native_widget_types.h"
10
11namespace content {
12
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.
17template<>
18class Source<gfx::NativeWindow> : public content::NotificationSource {
19 public:
20  explicit Source(gfx::NativeWindow wnd) : content::NotificationSource(wnd) {}
21
22  explicit Source(const content::NotificationSource& other)
23      : content::NotificationSource(other) {}
24
25  gfx::NativeWindow operator->() const { return ptr(); }
26  gfx::NativeWindow ptr() const {
27    return static_cast<gfx::NativeWindow>(const_cast<void*>(ptr_));
28  }
29};
30
31}
32
33#endif  // CHROME_BROWSER_NATIVE_WINDOW_NOTIFICATION_SOURCE_H_
34