diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-08 01:44:20 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-08 01:44:20 +0000 |
commit | 0e9f4ee56fac076c7128c746d48a53720ea3f4e2 (patch) | |
tree | ed0583cca018614dbe49292ad4c4720ece31b571 /chrome/browser/automation/automation_window_tracker.h | |
parent | 18ad9e8b0e3f747daf065f9581450cd51d0b4349 (diff) | |
download | chromium_src-0e9f4ee56fac076c7128c746d48a53720ea3f4e2.zip chromium_src-0e9f4ee56fac076c7128c746d48a53720ea3f4e2.tar.gz chromium_src-0e9f4ee56fac076c7128c746d48a53720ea3f4e2.tar.bz2 |
posix: implement AutomationWindowTracker.
Review URL: http://codereview.chromium.org/62135
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13331 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_window_tracker.h')
-rw-r--r-- | chrome/browser/automation/automation_window_tracker.h | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/chrome/browser/automation/automation_window_tracker.h b/chrome/browser/automation/automation_window_tracker.h index decaabb4..cc70dd8 100644 --- a/chrome/browser/automation/automation_window_tracker.h +++ b/chrome/browser/automation/automation_window_tracker.h @@ -5,26 +5,49 @@ #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_WINDOW_TRACKER_H__ #define CHROME_BROWSER_AUTOMATION_AUTOMATION_WINDOW_TRACKER_H__ +#include "base/gfx/native_widget_types.h" +#include "build/build_config.h" #include "chrome/browser/automation/automation_resource_tracker.h" + +#if defined(OS_WIN) +// Since HWNDs aren't pointers, we can't have NativeWindow +// be directly a pointer and so must explicitly declare the Source types +// for it. #include "chrome/views/widget/hwnd_notification_source.h" +#elif defined(OS_LINUX) || defined(OS_MACOSX) +// But on Linux and Mac, it is a pointer so this definition suffices. +template<> +class Source<gfx::NativeWindow> : public NotificationSource { + public: + explicit Source(gfx::NativeWindow win) : NotificationSource(win) {} + + explicit Source(const NotificationSource& other) + : NotificationSource(other) {} + + gfx::NativeWindow operator->() const { return ptr(); } + gfx::NativeWindow ptr() const { return static_cast<gfx::NativeWindow>(ptr_); } +}; +#endif class AutomationWindowTracker - : public AutomationResourceTracker<HWND> { + : public AutomationResourceTracker<gfx::NativeWindow> { public: AutomationWindowTracker(IPC::Message::Sender* automation) - : AutomationResourceTracker(automation) { } + : AutomationResourceTracker<gfx::NativeWindow>(automation) { } virtual ~AutomationWindowTracker() { ClearAllMappings(); } - virtual void AddObserver(HWND resource) { + virtual void AddObserver(gfx::NativeWindow resource) { NotificationService::current()->AddObserver( - this, NotificationType::WINDOW_CLOSED, Source<HWND>(resource)); + this, NotificationType::WINDOW_CLOSED, + Source<gfx::NativeWindow>(resource)); } - virtual void RemoveObserver(HWND resource) { + virtual void RemoveObserver(gfx::NativeWindow resource) { NotificationService::current()->RemoveObserver( - this, NotificationType::WINDOW_CLOSED, Source<HWND>(resource)); + this, NotificationType::WINDOW_CLOSED, + Source<gfx::NativeWindow>(resource)); } }; |