Fix zoom issue when enter fullscreen from media element
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / WebFullScreenManagerProxy.h
1 /*
2  * Copyright (C) 2011 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 WebFullScreenManagerProxy_h
27 #define WebFullScreenManagerProxy_h
28
29 #if ENABLE(FULLSCREEN_API)
30
31 #include "Connection.h"
32 #include <wtf/PassRefPtr.h>
33 #include <wtf/RefPtr.h>
34
35 namespace CoreIPC {
36 class ArgumentDecoder;
37 class Connection;
38 class MessageID;
39 }
40
41 namespace WebCore {
42 class IntRect;
43 }
44
45 #if PLATFORM(MAC)
46 OBJC_CLASS WKView;
47 #elif PLATFORM(GTK)
48 typedef struct _WebKitWebViewBase WebKitWebViewBase;
49 #elif PLATFORM(QT)
50 class QQuickWebView;
51 #endif
52
53 namespace WebKit {
54     
55 #if PLATFORM(MAC)
56 typedef WKView PlatformWebView;
57 #elif PLATFORM(WIN)
58 class WebView;
59 typedef WebView PlatformWebView;
60 #elif PLATFORM(QT)
61 typedef QQuickWebView PlatformWebView;
62 #elif PLATFORM(GTK)
63 typedef WebKitWebViewBase PlatformWebView;
64 #elif PLATFORM(EFL)
65 typedef Evas_Object PlatformWebView;
66 #endif
67
68 class WebPageProxy;
69 class LayerTreeContext;
70
71 class WebFullScreenManagerProxy : public RefCounted<WebFullScreenManagerProxy> {
72 public:
73     static PassRefPtr<WebFullScreenManagerProxy> create(WebPageProxy*);
74     virtual ~WebFullScreenManagerProxy();
75
76     void invalidate();
77
78     void setWebView(PlatformWebView*);
79     bool isFullScreen();
80     void close();
81
82     void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
83     void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply);
84
85     void willEnterFullScreen();
86     void didEnterFullScreen();
87     void willExitFullScreen();
88     void didExitFullScreen();
89     void setAnimatingFullScreen(bool);
90     void requestExitFullScreen();
91
92 private:
93     WebFullScreenManagerProxy(WebPageProxy*);
94
95     void supportsFullScreen(bool withKeyboard, bool&);
96     void enterFullScreen();
97     void exitFullScreen();
98 #if ENABLE(TIZEN_FULLSCREEN_API)
99     void enterFullScreenForMediaElement();
100     void exitFullScreenForMediaElement();
101 #endif
102     void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame);
103     void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame);
104
105     WebPageProxy* m_page;
106     PlatformWebView* m_webView;
107     bool m_isFullScreen;
108 #if ENABLE(TIZEN_FULLSCREEN_API)
109     double m_previousMinimumScale;
110     float m_previousScaleFactor;
111 #endif
112
113     void didReceiveWebFullScreenManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
114     void didReceiveSyncWebFullScreenManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply);
115 };
116
117 } // namespace WebKit
118
119 #endif // ENABLE(FULLSCREEN_API)
120
121 #endif // WebFullScreenManagerProxy_h