source: webkit/trunk/Source/WebKit/UIProcess/WebFullScreenManagerProxy.h

Last change on this file was 285741, checked in by Peng Liu, 3 years ago

Promote WKPreferences._fullScreenEnabled to API
https://bugs.webkit.org/show_bug.cgi?id=230784
<rdar://83255308>

Reviewed by Jer Noble.

Source/WebKit:

  • UIProcess/API/Cocoa/WKPreferences.h:
  • UIProcess/API/Cocoa/WKPreferences.mm:

(-[WKPreferences isElementFullscreenEnabled]):
(-[WKPreferences setElementFullscreenEnabled:]):

  • UIProcess/API/Cocoa/WKWebView.h:
  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView fullscreenState]):

  • UIProcess/Cocoa/FullscreenClient.h:
  • UIProcess/Cocoa/FullscreenClient.mm:

(WebKit::FullscreenClient::willEnterFullscreen):
(WebKit::FullscreenClient::didEnterFullscreen):
(WebKit::FullscreenClient::willExitFullscreen):
(WebKit::FullscreenClient::didExitFullscreen):

  • UIProcess/Cocoa/WebViewImpl.mm:

(WebKit::WebViewImpl::WebViewImpl):

  • UIProcess/WebFullScreenManagerProxy.cpp:

(WebKit::WebFullScreenManagerProxy::willEnterFullScreen):
(WebKit::WebFullScreenManagerProxy::didEnterFullScreen):
(WebKit::WebFullScreenManagerProxy::willExitFullScreen):
(WebKit::WebFullScreenManagerProxy::didExitFullScreen):

  • UIProcess/WebFullScreenManagerProxy.h:

(WebKit::WebFullScreenManagerProxy::fullscreenState const):

Tools:

  • MiniBrowser/mac/AppDelegate.m:

(-[BrowserAppDelegate defaultConfiguration]):

  • Property svn:eol-style set to native
File size: 4.1 KB
Line 
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#pragma once
27
28#if ENABLE(FULLSCREEN_API)
29
30#include "MessageReceiver.h"
31#include <wtf/CompletionHandler.h>
32#include <wtf/RefCounted.h>
33#include <wtf/RefPtr.h>
34#include <wtf/Seconds.h>
35#include <wtf/Vector.h>
36
37namespace WebCore {
38class IntRect;
39
40template <typename> class RectEdges;
41using FloatBoxExtent = RectEdges<float>;
42}
43
44namespace WebKit {
45
46class WebPageProxy;
47
48class WebFullScreenManagerProxyClient {
49public:
50 virtual ~WebFullScreenManagerProxyClient() { }
51
52 virtual void closeFullScreenManager() = 0;
53 virtual bool isFullScreen() = 0;
54 virtual void enterFullScreen() = 0;
55 virtual void exitFullScreen() = 0;
56 virtual void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) = 0;
57 virtual void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) = 0;
58};
59
60class WebFullScreenManagerProxy : public IPC::MessageReceiver {
61 WTF_MAKE_FAST_ALLOCATED;
62public:
63 WebFullScreenManagerProxy(WebPageProxy&, WebFullScreenManagerProxyClient&);
64 virtual ~WebFullScreenManagerProxy();
65
66 bool isFullScreen();
67 bool blocksReturnToFullscreenFromPictureInPicture() const;
68 void close();
69
70 enum class FullscreenState : uint8_t {
71 NotInFullscreen,
72 EnteringFullscreen,
73 InFullscreen,
74 ExitingFullscreen,
75 };
76 FullscreenState fullscreenState() const { return m_fullscreenState; }
77
78 void willEnterFullScreen();
79 void didEnterFullScreen();
80 void willExitFullScreen();
81 void didExitFullScreen();
82 void setAnimatingFullScreen(bool);
83 void requestEnterFullScreen();
84 void requestExitFullScreen();
85 void saveScrollPosition();
86 void restoreScrollPosition();
87 void setFullscreenInsets(const WebCore::FloatBoxExtent&);
88 void setFullscreenAutoHideDuration(Seconds);
89 void setFullscreenControlsHidden(bool);
90 void closeWithCallback(CompletionHandler<void()>&&);
91
92private:
93 void supportsFullScreen(bool withKeyboard, CompletionHandler<void(bool)>&&);
94 void enterFullScreen(bool blocksReturnToFullscreenFromPictureInPicture);
95 void exitFullScreen();
96 void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame);
97 void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame);
98 void callCloseCompletionHandlers();
99
100 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
101 bool didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, UniqueRef<IPC::Encoder>&) override;
102
103 WebPageProxy& m_page;
104 WebFullScreenManagerProxyClient& m_client;
105 FullscreenState m_fullscreenState { FullscreenState::NotInFullscreen };
106 bool m_blocksReturnToFullscreenFromPictureInPicture { false };
107 Vector<CompletionHandler<void()>> m_closeCompletionHandlers;
108};
109
110} // namespace WebKit
111
112#endif // ENABLE(FULLSCREEN_API)
Note: See TracBrowser for help on using the repository browser.