Commit 2b77bec1 authored by weinig@apple.com's avatar weinig@apple.com

Fix for https://bugs.webkit.org/show_bug.cgi?id=42986

Add prompt and confirm client functions to WebKit2

Reviewed by Anders Carlsson.

WebKit2: 

* Shared/CoreIPCSupport/WebPageProxyMessageKinds.h:
(WebPageProxyMessage::):
* UIProcess/API/C/WKPage.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didReceiveSyncMessage):
(WebKit::WebPageProxy::runJavaScriptAlert):
(WebKit::WebPageProxy::runJavaScriptConfirm):
(WebKit::WebPageProxy::runJavaScriptPrompt):
* UIProcess/WebPageProxy.h:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::runJavaScriptAlert):
(WebKit::WebUIClient::runJavaScriptConfirm):
(WebKit::WebUIClient::runJavaScriptPrompt):
* UIProcess/WebUIClient.h:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::runJavaScriptConfirm):
(WebKit::WebChromeClient::runJavaScriptPrompt):

WebKitTools: 

* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController awakeFromNib]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6ba845ca
2010-07-26 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fix for https://bugs.webkit.org/show_bug.cgi?id=42986
Add prompt and confirm client functions to WebKit2
* Shared/CoreIPCSupport/WebPageProxyMessageKinds.h:
(WebPageProxyMessage::):
* UIProcess/API/C/WKPage.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didReceiveSyncMessage):
(WebKit::WebPageProxy::runJavaScriptAlert):
(WebKit::WebPageProxy::runJavaScriptConfirm):
(WebKit::WebPageProxy::runJavaScriptPrompt):
* UIProcess/WebPageProxy.h:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::runJavaScriptAlert):
(WebKit::WebUIClient::runJavaScriptConfirm):
(WebKit::WebUIClient::runJavaScriptPrompt):
* UIProcess/WebUIClient.h:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::runJavaScriptConfirm):
(WebKit::WebChromeClient::runJavaScriptPrompt):
2010-07-26 Adam Roben <aroben@apple.com> 2010-07-26 Adam Roben <aroben@apple.com>
Windows build fix Windows build fix
......
...@@ -36,6 +36,8 @@ enum Kind { ...@@ -36,6 +36,8 @@ enum Kind {
CreateNewPage, CreateNewPage,
ShowPage, ShowPage,
RunJavaScriptAlert, RunJavaScriptAlert,
RunJavaScriptConfirm,
RunJavaScriptPrompt,
ClosePage, ClosePage,
DecidePolicyForMIMEType, DecidePolicyForMIMEType,
......
...@@ -116,6 +116,8 @@ typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, const void *cli ...@@ -116,6 +116,8 @@ typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, const void *cli
typedef void (*WKPageShowPageCallback)(WKPageRef page, const void *clientInfo); typedef void (*WKPageShowPageCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageCloseCallback)(WKPageRef page, const void *clientInfo); typedef void (*WKPageCloseCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo); typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo);
typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo);
struct WKPageUIClient { struct WKPageUIClient {
int version; int version;
...@@ -124,6 +126,8 @@ struct WKPageUIClient { ...@@ -124,6 +126,8 @@ struct WKPageUIClient {
WKPageShowPageCallback showPage; WKPageShowPageCallback showPage;
WKPageCloseCallback close; WKPageCloseCallback close;
WKPageRunJavaScriptAlertCallback runJavaScriptAlert; WKPageRunJavaScriptAlertCallback runJavaScriptAlert;
WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm;
WKPageRunJavaScriptPromptCallback runJavaScriptPrompt;
}; };
typedef struct WKPageUIClient WKPageUIClient; typedef struct WKPageUIClient WKPageUIClient;
......
...@@ -649,13 +649,35 @@ void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIP ...@@ -649,13 +649,35 @@ void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIP
} }
case WebPageProxyMessage::RunJavaScriptAlert: { case WebPageProxyMessage::RunJavaScriptAlert: {
uint64_t frameID; uint64_t frameID;
String alertText; String message;
if (!arguments.decode(CoreIPC::Out(frameID, alertText))) if (!arguments.decode(CoreIPC::Out(frameID, message)))
return; return;
runJavaScriptAlert(webFrame(frameID), alertText); runJavaScriptAlert(webFrame(frameID), message);
break; break;
} }
case WebPageProxyMessage::RunJavaScriptConfirm: {
// FIXME: We should probably encode something in the case that the arguments do not decode correctly.
uint64_t frameID;
String message;
if (!arguments.decode(CoreIPC::Out(frameID, message)))
return;
bool result = runJavaScriptConfirm(webFrame(frameID), message);
reply.encode(CoreIPC::In(result));
break;
}
case WebPageProxyMessage::RunJavaScriptPrompt: {
// FIXME: We should probably encode something in the case that the arguments do not decode correctly.
uint64_t frameID;
String message;
String defaultValue;
if (!arguments.decode(CoreIPC::Out(frameID, message, defaultValue)))
return;
String result = runJavaScriptPrompt(webFrame(frameID), message, defaultValue);
reply.encode(CoreIPC::In(result));
break;
}
case WebPageProxyMessage::BackForwardCurrentItem: { case WebPageProxyMessage::BackForwardCurrentItem: {
WebBackForwardListItem* currentItem = m_backForwardList->currentItem(); WebBackForwardListItem* currentItem = m_backForwardList->currentItem();
uint64_t currentItemID = currentItem ? currentItem->itemID() : 0; uint64_t currentItemID = currentItem ? currentItem->itemID() : 0;
...@@ -832,11 +854,20 @@ void WebPageProxy::closePage() ...@@ -832,11 +854,20 @@ void WebPageProxy::closePage()
m_uiClient.close(this); m_uiClient.close(this);
} }
void WebPageProxy::runJavaScriptAlert(WebFrameProxy* frame, const WebCore::String& alertText) void WebPageProxy::runJavaScriptAlert(WebFrameProxy* frame, const String& message)
{ {
m_uiClient.runJavaScriptAlert(this, alertText.impl(), frame); m_uiClient.runJavaScriptAlert(this, message, frame);
} }
bool WebPageProxy::runJavaScriptConfirm(WebFrameProxy* frame, const String& message)
{
return m_uiClient.runJavaScriptConfirm(this, message, frame);
}
String WebPageProxy::runJavaScriptPrompt(WebFrameProxy* frame, const String& message, const String& defaultValue)
{
return m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame);
}
// HistoryClient // HistoryClient
......
...@@ -187,6 +187,8 @@ private: ...@@ -187,6 +187,8 @@ private:
void showPage(); void showPage();
void closePage(); void closePage();
void runJavaScriptAlert(WebFrameProxy*, const WebCore::String&); void runJavaScriptAlert(WebFrameProxy*, const WebCore::String&);
bool runJavaScriptConfirm(WebFrameProxy* frame, const WebCore::String&);
WebCore::String runJavaScriptPrompt(WebFrameProxy* frame, const WebCore::String&, const WebCore::String&);
void didNavigateWithNavigationData(WebFrameProxy*, const WebNavigationDataStore&); void didNavigateWithNavigationData(WebFrameProxy*, const WebNavigationDataStore&);
void didPerformClientRedirect(WebFrameProxy*, const WebCore::String& sourceURLString, const WebCore::String& destinationURLString); void didPerformClientRedirect(WebFrameProxy*, const WebCore::String& sourceURLString, const WebCore::String& destinationURLString);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "WebUIClient.h" #include "WebUIClient.h"
#include "WKAPICast.h" #include "WKAPICast.h"
#include <WebCore/PlatformString.h>
#include <string.h> #include <string.h>
using namespace WebCore; using namespace WebCore;
...@@ -69,13 +70,35 @@ void WebUIClient::close(WebPageProxy* page) ...@@ -69,13 +70,35 @@ void WebUIClient::close(WebPageProxy* page)
m_pageUIClient.close(toRef(page), m_pageUIClient.clientInfo); m_pageUIClient.close(toRef(page), m_pageUIClient.clientInfo);
} }
void WebUIClient::runJavaScriptAlert(WebPageProxy* page, StringImpl* alertText, WebFrameProxy* frame) void WebUIClient::runJavaScriptAlert(WebPageProxy* page, const String& message, WebFrameProxy* frame)
{ {
if (!m_pageUIClient.runJavaScriptAlert) if (!m_pageUIClient.runJavaScriptAlert)
return; return;
m_pageUIClient.runJavaScriptAlert(toRef(page), toRef(alertText), toRef(frame), m_pageUIClient.clientInfo); m_pageUIClient.runJavaScriptAlert(toRef(page), toRef(message.impl()), toRef(frame), m_pageUIClient.clientInfo);
} }
bool WebUIClient::runJavaScriptConfirm(WebPageProxy* page, const String& message, WebFrameProxy* frame)
{
if (!m_pageUIClient.runJavaScriptConfirm)
return false;
return m_pageUIClient.runJavaScriptConfirm(toRef(page), toRef(message.impl()), toRef(frame), m_pageUIClient.clientInfo);
}
String WebUIClient::runJavaScriptPrompt(WebPageProxy* page, const String& message, const String& defaultValue, WebFrameProxy* frame)
{
if (!m_pageUIClient.runJavaScriptPrompt)
return String();
StringImpl* impl = toWK(m_pageUIClient.runJavaScriptPrompt(toRef(page), toRef(message.impl()), toRef(defaultValue.impl()), toRef(frame), m_pageUIClient.clientInfo));
if (!impl)
return String();
String result = impl;
impl->deref();
return result;
}
} // namespace WebKit } // namespace WebKit
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "WKPage.h" #include "WKPage.h"
namespace WebCore { namespace WebCore {
class StringImpl; class String;
} }
namespace WebKit { namespace WebKit {
...@@ -45,7 +45,9 @@ public: ...@@ -45,7 +45,9 @@ public:
WebPageProxy* createNewPage(WebPageProxy*); WebPageProxy* createNewPage(WebPageProxy*);
void showPage(WebPageProxy*); void showPage(WebPageProxy*);
void close(WebPageProxy*); void close(WebPageProxy*);
void runJavaScriptAlert(WebPageProxy*, WebCore::StringImpl*, WebFrameProxy*); void runJavaScriptAlert(WebPageProxy*, const WebCore::String&, WebFrameProxy*);
bool runJavaScriptConfirm(WebPageProxy*, const WebCore::String&, WebFrameProxy*);
WebCore::String runJavaScriptPrompt(WebPageProxy*, const WebCore::String&, const WebCore::String&, WebFrameProxy*);
private: private:
WKPageUIClient m_pageUIClient; WKPageUIClient m_pageUIClient;
......
...@@ -367,7 +367,7 @@ ...@@ -367,7 +367,7 @@
32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2Prefix.h; sourceTree = "<group>"; }; 32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2Prefix.h; sourceTree = "<group>"; };
5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebProcess.xcconfig; sourceTree = "<group>"; }; 5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebProcess.xcconfig; sourceTree = "<group>"; };
5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = BaseTarget.xcconfig; sourceTree = "<group>"; }; 5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = BaseTarget.xcconfig; sourceTree = "<group>"; };
6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.WebProcess.sb; sourceTree = "<group>"; }; 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebProcess.sb; path = WebProcess/com.apple.WebProcess.sb; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* WebKit2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebKit2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8DC2EF5B0486A6940098B216 /* WebKit2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebKit2.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BC0092F5115837A300E0AE2A /* RunLoopMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RunLoopMac.mm; sourceTree = "<group>"; }; BC0092F5115837A300E0AE2A /* RunLoopMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RunLoopMac.mm; sourceTree = "<group>"; };
...@@ -498,7 +498,6 @@ ...@@ -498,7 +498,6 @@
BCB63477116BF10600603215 /* WebKit2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2.h; sourceTree = "<group>"; }; BCB63477116BF10600603215 /* WebKit2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2.h; sourceTree = "<group>"; };
BCB7346D11CEE3FF00EC5002 /* WebProcessProxyMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessProxyMessageKinds.h; sourceTree = "<group>"; }; BCB7346D11CEE3FF00EC5002 /* WebProcessProxyMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessProxyMessageKinds.h; sourceTree = "<group>"; };
BCB86F4B116AAACD00CE20B7 /* WebKit2.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebKit2.xcconfig; sourceTree = "<group>"; }; BCB86F4B116AAACD00CE20B7 /* WebKit2.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebKit2.xcconfig; sourceTree = "<group>"; };
BCB8D4E011AF78C1008F9103 /* WebKit2.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; name = WebKit2.exp; path = mac/WebKit2.exp; sourceTree = "<group>"; };
BCB9E2411120DACA00A137E0 /* WebContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContext.h; sourceTree = "<group>"; }; BCB9E2411120DACA00A137E0 /* WebContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContext.h; sourceTree = "<group>"; };
BCB9E2421120DACA00A137E0 /* WebContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContext.cpp; sourceTree = "<group>"; }; BCB9E2421120DACA00A137E0 /* WebContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContext.cpp; sourceTree = "<group>"; };
BCB9E2491120E15C00A137E0 /* WKContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContext.h; sourceTree = "<group>"; }; BCB9E2491120E15C00A137E0 /* WKContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContext.h; sourceTree = "<group>"; };
...@@ -619,8 +618,8 @@ ...@@ -619,8 +618,8 @@
children = ( children = (
BC8A500E11765AD400757573 /* WebKit2 */, BC8A500E11765AD400757573 /* WebKit2 */,
BC8A500F11765AE300757573 /* WebProcess */, BC8A500F11765AE300757573 /* WebProcess */,
6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */,
089C1666FE841158C02AAC07 /* InfoPlist.strings */, 089C1666FE841158C02AAC07 /* InfoPlist.strings */,
BCB8D4E011AF78C1008F9103 /* WebKit2.exp */,
); );
name = Resources; name = Resources;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -796,7 +795,6 @@ ...@@ -796,7 +795,6 @@
BC032D5C10F436D50058C15A /* WebProcess */ = { BC032D5C10F436D50058C15A /* WebProcess */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */,
BC204EDF11C83E72008F3375 /* InjectedBundle */, BC204EDF11C83E72008F3375 /* InjectedBundle */,
1A6FA01C11E1526300DB1371 /* mac */, 1A6FA01C11E1526300DB1371 /* mac */,
1A6FB7AA11E64B4900DB1371 /* Plugins */, 1A6FB7AA11E64B4900DB1371 /* Plugins */,
......
...@@ -229,8 +229,15 @@ bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String& message) ...@@ -229,8 +229,15 @@ bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String& message)
// Notify the bundle client. // Notify the bundle client.
m_page->injectedBundleUIClient().willRunJavaScriptConfirm(m_page, message, webFrame); m_page->injectedBundleUIClient().willRunJavaScriptConfirm(m_page, message, webFrame);
// Implement for UIProcess. bool result = false;
return false; if (!WebProcess::shared().connection()->sendSync(WebPageProxyMessage::RunJavaScriptConfirm, m_page->pageID(),
CoreIPC::In(webFrame->frameID(), message),
CoreIPC::Out(result),
CoreIPC::Connection::NoTimeout)) {
return false;
}
return result;
} }
bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result) bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
...@@ -240,8 +247,14 @@ bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, c ...@@ -240,8 +247,14 @@ bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, c
// Notify the bundle client. // Notify the bundle client.
m_page->injectedBundleUIClient().willRunJavaScriptPrompt(m_page, message, defaultValue, webFrame); m_page->injectedBundleUIClient().willRunJavaScriptPrompt(m_page, message, defaultValue, webFrame);
// Implement for UIProcess. if (!WebProcess::shared().connection()->sendSync(WebPageProxyMessage::RunJavaScriptPrompt, m_page->pageID(),
return false; CoreIPC::In(webFrame->frameID(), message, defaultValue),
CoreIPC::Out(result),
CoreIPC::Connection::NoTimeout)) {
return false;
}
return !result.isNull();
} }
void WebChromeClient::setStatusbarText(const String& statusbarText) void WebChromeClient::setStatusbarText(const String& statusbarText)
......
2010-07-26 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fix for https://bugs.webkit.org/show_bug.cgi?id=42986
Add prompt and confirm client functions to WebKit2
* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController awakeFromNib]):
2010-07-26 Adam Roben <aroben@apple.com> 2010-07-26 Adam Roben <aroben@apple.com>
Windows build fix Windows build fix
......
MODULES = DumpRenderTree MiniBrowser MODULES = DumpRenderTree WebKitTestRunner MiniBrowser
all: all:
@for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \ @for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \
......
...@@ -152,105 +152,105 @@ - (void)applicationTerminating ...@@ -152,105 +152,105 @@ - (void)applicationTerminating
#pragma mark Loader Client Callbacks #pragma mark Loader Client Callbacks
static void _didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) static void didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo)
{ {
[(BrowserWindowController *)clientInfo didStartProvisionalLoadForFrame:frame]; [(BrowserWindowController *)clientInfo didStartProvisionalLoadForFrame:frame];
} }
static void _didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo)
{ {
[(BrowserWindowController *)clientInfo didReceiveServerRedirectForProvisionalLoadForFrame:frame]; [(BrowserWindowController *)clientInfo didReceiveServerRedirectForProvisionalLoadForFrame:frame];
} }
static void _didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) static void didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo)
{ {
[(BrowserWindowController *)clientInfo didFailProvisionalLoadWithErrorForFrame:frame]; [(BrowserWindowController *)clientInfo didFailProvisionalLoadWithErrorForFrame:frame];
} }
static void _didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) static void didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo)
{ {
[(BrowserWindowController *)clientInfo didCommitLoadForFrame:frame]; [(BrowserWindowController *)clientInfo didCommitLoadForFrame:frame];
} }
static void _didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo)
{ {
LOG(@"didFinishLoadForFrame"); LOG(@"didFinishLoadForFrame");
} }
static void _didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) static void didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo)
{ {
[(BrowserWindowController *)clientInfo didFailLoadWithErrorForFrame:frame]; [(BrowserWindowController *)clientInfo didFailLoadWithErrorForFrame:frame];
} }
static void _didReceiveTitleForFrame(WKPageRef page, WKStringRef title, WKFrameRef frame, const void *clientInfo) static void didReceiveTitleForFrame(WKPageRef page, WKStringRef title, WKFrameRef frame, const void *clientInfo)
{ {
CFStringRef cfTitle = WKStringCopyCFString(0, title); CFStringRef cfTitle = WKStringCopyCFString(0, title);
LOG(@"didReceiveTitleForFrame \"%@\"", (NSString *)cfTitle); LOG(@"didReceiveTitleForFrame \"%@\"", (NSString *)cfTitle);
CFRelease(cfTitle); CFRelease(cfTitle);
} }
static void _didFirstLayoutForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) static void didFirstLayoutForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo)
{ {
LOG(@"didFirstLayoutForFrame"); LOG(@"didFirstLayoutForFrame");
} }
static void _didFirstVisuallyNonEmptyLayoutForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) static void didFirstVisuallyNonEmptyLayoutForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo)
{ {
LOG(@"didFirstVisuallyNonEmptyLayoutForFrame"); LOG(@"didFirstVisuallyNonEmptyLayoutForFrame");
} }
static void _didStartProgress(WKPageRef page, const void *clientInfo) static void didStartProgress(WKPageRef page, const void *clientInfo)
{ {
[(BrowserWindowController *)clientInfo didStartProgress]; [(BrowserWindowController *)clientInfo didStartProgress];
} }
static void _didChangeProgress(WKPageRef page, const void *clientInfo) static void didChangeProgress(WKPageRef page, const void *clientInfo)
{ {
[(BrowserWindowController *)clientInfo didChangeProgress:WKPageGetEstimatedProgress(page)]; [(BrowserWindowController *)clientInfo didChangeProgress:WKPageGetEstimatedProgress(page)];
} }
static void _didFinishProgress(WKPageRef page, const void *clientInfo) static void didFinishProgress(WKPageRef page, const void *clientInfo)
{ {
[(BrowserWindowController *)clientInfo didFinishProgress]; [(BrowserWindowController *)clientInfo didFinishProgress];
} }
static void _didBecomeUnresponsive(WKPageRef page, const void *clientInfo) static void didBecomeUnresponsive(WKPageRef page, const void *clientInfo)
{ {
LOG(@"didBecomeUnresponsive"); LOG(@"didBecomeUnresponsive");
} }
static void _didBecomeResponsive(WKPageRef page, const void *clientInfo) static void didBecomeResponsive(WKPageRef page, const void *clientInfo)
{ {
LOG(@"didBecomeResponsive"); LOG(@"didBecomeResponsive");
} }
static void _didChangeBackForwardList(WKPageRef page, const void *clientInfo) static void didChangeBackForwardList(WKPageRef page, const void *clientInfo)
{ {
[(BrowserWindowController *)clientInfo validateToolbar]; [(BrowserWindowController *)clientInfo validateToolbar];
} }
#pragma mark Policy Client Callbacks #pragma mark Policy Client Callbacks
static void _decidePolicyForNavigationAction(WKPageRef page, WKFrameNavigationType navigationType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo) static void decidePolicyForNavigationAction(WKPageRef page, WKFrameNavigationType navigationType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo)
{ {
LOG(@"decidePolicyForNavigationAction"); LOG(@"decidePolicyForNavigationAction");
WKFramePolicyListenerUse(listener); WKFramePolicyListenerUse(listener);
} }
static void _decidePolicyForNewWindowAction(WKPageRef page, WKFrameNavigationType navigationType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo) static void decidePolicyForNewWindowAction(WKPageRef page, WKFrameNavigationType navigationType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo)
{ {
LOG(@"decidePolicyForNewWindowAction"); LOG(@"decidePolicyForNewWindowAction");
WKFramePolicyListenerUse(listener); WKFramePolicyListenerUse(listener);
} }
static void _decidePolicyForMIMEType(WKPageRef page, WKStringRef MIMEType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo) static void decidePolicyForMIMEType(WKPageRef page, WKStringRef MIMEType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo)
{ {
WKFramePolicyListenerUse(listener); WKFramePolicyListenerUse(listener);
} }
#pragma mark UI Client Callbacks #pragma mark UI Client Callbacks
static WKPageRef _createNewPage(WKPageRef page, const void* clientInfo) static WKPageRef createNewPage(WKPageRef page, const void* clientInfo)
{ {
LOG(@"createNewPage"); LOG(@"createNewPage");
BrowserWindowController *controller = [[BrowserWindowController alloc] initWithPageNamespace:WKPageGetPageNamespace(page)]; BrowserWindowController *controller = [[BrowserWindowController alloc] initWithPageNamespace:WKPageGetPageNamespace(page)];
...@@ -259,13 +259,13 @@ static WKPageRef _createNewPage(WKPageRef page, const void* clientInfo) ...@@ -259,13 +259,13 @@ static WKPageRef _createNewPage(WKPageRef page, const void* clientInfo)
return controller->_webView.pageRef; return controller->_webView.pageRef;
} }
static void _showPage(WKPageRef page, const void *clientInfo) static void showPage(WKPageRef page, const void *clientInfo)
{ {
LOG(@"showPage"); LOG(@"showPage");
[[(BrowserWindowController *)clientInfo window] orderFront:nil]; [[(BrowserWindowController *)clientInfo window] orderFront:nil];
} }
static void _closePage(WKPageRef page, const void *clientInfo) static void closePage(WKPageRef page, const void *clientInfo)
{ {
LOG(@"closePage"); LOG(@"closePage");
WKPageClose(page); WKPageClose(page);
...@@ -273,17 +273,17 @@ static void _closePage(WKPageRef page, const void *clientInfo) ...@@ -273,17 +273,17 @@ static void _closePage(WKPageRef page, const void *clientInfo)