Home | History | Annotate | Download | only in win
      1 /*
      2  * Copyright (C) 2010 Apple Inc. All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions
      6  * are met:
      7  * 1. Redistributions of source code must retain the above copyright
      8  *    notice, this list of conditions and the following disclaimer.
      9  * 2. Redistributions in binary form must reproduce the above copyright
     10  *    notice, this list of conditions and the following disclaimer in the
     11  *    documentation and/or other materials provided with the distribution.
     12  *
     13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
     14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
     17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     23  * THE POSSIBILITY OF SUCH DAMAGE.
     24  */
     25 
     26 #ifndef MediaPlayerPrivateFullscreenWindow_h
     27 #define MediaPlayerPrivateFullscreenWindow_h
     28 
     29 #include <wtf/RefPtr.h>
     30 
     31 #if USE(ACCELERATED_COMPOSITING)
     32 #include "CACFLayerTreeHostClient.h"
     33 #endif
     34 
     35 typedef unsigned WPARAM;
     36 typedef long LPARAM;
     37 typedef struct HWND__* HWND;
     38 typedef _W64 long LONG_PTR;
     39 typedef LONG_PTR LRESULT;
     40 typedef unsigned int UINT;
     41 
     42 namespace WebCore {
     43 
     44 #if USE(ACCELERATED_COMPOSITING)
     45 class CACFLayerTreeHost;
     46 class PlatformCALayer;
     47 #endif
     48 
     49 class MediaPlayerPrivateFullscreenClient {
     50 public:
     51     virtual LRESULT fullscreenClientWndProc(HWND, UINT message, WPARAM, LPARAM) = 0;
     52 protected:
     53     virtual ~MediaPlayerPrivateFullscreenClient() {}
     54 };
     55 
     56 class MediaPlayerPrivateFullscreenWindow {
     57 public:
     58     MediaPlayerPrivateFullscreenWindow(MediaPlayerPrivateFullscreenClient*);
     59     ~MediaPlayerPrivateFullscreenWindow();
     60 
     61     void createWindow(HWND ownerWindow);
     62 
     63     HWND hwnd() const { return m_hwnd; }
     64 
     65 #if USE(ACCELERATED_COMPOSITING)
     66     PlatformCALayer* rootChildLayer() const { return m_rootChild.get(); }
     67     void setRootChildLayer(PassRefPtr<PlatformCALayer>);
     68 #endif
     69 
     70 private:
     71     static LRESULT __stdcall staticWndProc(HWND, UINT message, WPARAM, LPARAM);
     72     LRESULT wndProc(HWND, UINT message, WPARAM, LPARAM);
     73 
     74     MediaPlayerPrivateFullscreenClient* m_client;
     75 #if USE(ACCELERATED_COMPOSITING)
     76     RefPtr<CACFLayerTreeHost> m_layerTreeHost;
     77     RefPtr<PlatformCALayer> m_rootChild;
     78 #endif
     79     HWND m_hwnd;
     80 };
     81 
     82 }
     83 
     84 #endif
     85