1e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke/*
2e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * Copyright (C) 2010 Apple Inc. All rights reserved.
3e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *
4e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * Redistribution and use in source and binary forms, with or without
5e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * modification, are permitted provided that the following conditions
6e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * are met:
7e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * 1. Redistributions of source code must retain the above copyright
8e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *    notice, this list of conditions and the following disclaimer.
9e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * 2. Redistributions in binary form must reproduce the above copyright
10e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *    notice, this list of conditions and the following disclaimer in the
11e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *    documentation and/or other materials provided with the distribution.
12e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *
13e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * THE POSSIBILITY OF SUCH DAMAGE.
24e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke */
25e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
2628040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu#ifndef WindowedPluginTest_h
2728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu#define WindowedPluginTest_h
28e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
2928040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu#include "PluginTest.h"
30e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
3128040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhuclass WindowedPluginTest : public PluginTest {
3228040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhuprotected:
3328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu    WindowedPluginTest(NPP, const std::string& identifier);
34e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
3528040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu    HWND window() const { return m_window; }
36e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
3728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu    // For derived classes to override
3828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu    virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled) = 0;
39e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
4028040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu    // PluginTest
4128040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu    virtual NPError NPP_SetWindow(NPP, NPWindow*);
42e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
4328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhuprivate:
4428040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu    static LRESULT CALLBACK staticWndProc(HWND, UINT message, WPARAM, LPARAM);
45e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
4628040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu    HWND m_window;
4728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu    WNDPROC m_originalWndProc;
4828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu};
49e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
5028040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu#endif // WindowedPluginTest_h
51