Changeset 69460 in webkit
- Timestamp:
- Oct 9, 2010 2:58:16 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r69457 r69460 1 2010-10-09 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Dan Bernstein. 4 5 Add WebKit2 version of runBeforeUnloadConfirmPanelWithMessage 6 <rdar://problem/8447690> 7 https://bugs.webkit.org/show_bug.cgi?id=47459 8 9 * UIProcess/API/C/WKPage.h: 10 * UIProcess/API/qt/qwkpage.cpp: 11 (QWKPage::QWKPage): 12 * UIProcess/WebPageProxy.cpp: 13 (WebKit::WebPageProxy::setWindowFrame): 14 (WebKit::WebPageProxy::getWindowFrame): 15 (WebKit::WebPageProxy::canRunBeforeUnloadConfirmPanel): 16 (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel): 17 * UIProcess/WebPageProxy.h: 18 * UIProcess/WebPageProxy.messages.in: 19 * UIProcess/WebUIClient.cpp: 20 (WebKit::WebUIClient::canRunBeforeUnloadConfirmPanel): 21 (WebKit::WebUIClient::runBeforeUnloadConfirmPanel): 22 * UIProcess/WebUIClient.h: 23 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 24 (WebKit::WebChromeClient::canRunBeforeUnloadConfirmPanel): 25 (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel): 26 Pipe calls through to the UIProcess. 27 1 28 2010-10-09 Sam Weinig <sam@webkit.org> 2 29 -
trunk/WebKit2/UIProcess/API/C/WKPage.h
r69457 r69460 142 142 typedef WKRect (*WKPageGetWindowFrameCallback)(WKPageRef page, const void *clientInfo); 143 143 typedef void (*WKPageSetWindowFrameCallback)(WKPageRef page, WKRect frame, const void *clientInfo); 144 typedef bool (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo); 144 145 145 146 struct WKPageUIClient { … … 158 159 WKPageGetWindowFrameCallback getWindowFrame; 159 160 WKPageSetWindowFrameCallback setWindowFrame; 161 WKPageRunBeforeUnloadConfirmPanelCallback runBeforeUnloadConfirmPanel; 160 162 }; 161 163 typedef struct WKPageUIClient WKPageUIClient; -
trunk/WebKit2/UIProcess/API/qt/qwkpage.cpp
r69457 r69460 284 284 0, /* contentsSizeChanged */ 285 285 0, /* didNotHandleKeyEvent */ 286 0, /* getWindowRect */ 287 0 /* setWindowRect */ 286 0, /* getWindowFrame */ 287 0, /* setWindowFrame */ 288 0 /* runBeforeUnloadConfirmPanel */ 288 289 }; 289 290 WKPageSetPageUIClient(pageRef(), &uiClient); -
trunk/WebKit2/UIProcess/WebPageProxy.cpp
r69457 r69460 866 866 } 867 867 868 void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame) 869 { 870 m_uiClient.setWindowFrame(this, m_pageClient->transformToDeviceSpace(newWindowFrame)); 871 } 872 873 void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame) 874 { 875 newWindowFrame = m_pageClient->transformToUserSpace(m_uiClient.windowFrame(this)); 876 } 877 878 void WebPageProxy::canRunBeforeUnloadConfirmPanel(bool& canRun) 879 { 880 canRun = m_uiClient.canRunBeforeUnloadConfirmPanel(); 881 } 882 883 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose) 884 { 885 shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, process()->webFrame(frameID)); 886 } 887 868 888 // BackForwardList 869 889 … … 970 990 { 971 991 m_pageClient->setEditCommandState(commandName, isEnabled, state); 972 }973 974 void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)975 {976 m_uiClient.setWindowFrame(this, m_pageClient->transformToDeviceSpace(newWindowFrame));977 }978 979 void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)980 {981 newWindowFrame = m_pageClient->transformToUserSpace(m_uiClient.windowFrame(this));982 992 } 983 993 -
trunk/WebKit2/UIProcess/WebPageProxy.h
r69457 r69460 248 248 void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*); 249 249 250 // UI client 250 251 void createNewPage(uint64_t& newPageID, WebPageCreationParameters&); 251 252 void showPage(); … … 257 258 void mouseDidMoveOverElement(uint32_t modifiers, CoreIPC::ArgumentDecoder*); 258 259 void contentsSizeChanged(uint64_t frameID, const WebCore::IntSize&); 260 void setWindowFrame(const WebCore::FloatRect&); 261 void getWindowFrame(WebCore::FloatRect&); 262 void canRunBeforeUnloadConfirmPanel(bool& canRun); 263 void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose); 259 264 260 265 // Back/Forward list management … … 279 284 void setCursor(const WebCore::Cursor&); 280 285 void didValidateMenuItem(const String& commandName, bool isEnabled, int32_t state); 281 282 void setWindowFrame(const WebCore::FloatRect&); 283 void getWindowFrame(WebCore::FloatRect&); 284 286 285 287 void didReceiveEvent(uint32_t opaqueType, bool handled); 286 288 -
trunk/WebKit2/UIProcess/WebPageProxy.messages.in
r69457 r69460 39 39 SetWindowFrame(WebCore::FloatRect windowFrame) 40 40 GetWindowFrame() -> (WebCore::FloatRect windowFrame) 41 CanRunBeforeUnloadConfirmPanel() -> (bool canRun) 42 RunBeforeUnloadConfirmPanel(WTF::String message, uint64_t frameID) -> (bool shouldClose) 41 43 42 44 # Policy messages. -
trunk/WebKit2/UIProcess/WebUIClient.cpp
r69457 r69460 154 154 } 155 155 156 bool WebUIClient::canRunBeforeUnloadConfirmPanel() 157 { 158 return m_pageUIClient.runBeforeUnloadConfirmPanel; 159 } 160 161 bool WebUIClient::runBeforeUnloadConfirmPanel(WebPageProxy* page, const String& message, WebFrameProxy* frame) 162 { 163 if (!m_pageUIClient.runBeforeUnloadConfirmPanel) 164 return true; 165 166 return m_pageUIClient.runBeforeUnloadConfirmPanel(toAPI(page), toAPI(message.impl()), toAPI(frame), m_pageUIClient.clientInfo); 167 } 168 156 169 } // namespace WebKit -
trunk/WebKit2/UIProcess/WebUIClient.h
r69457 r69460 51 51 void showPage(WebPageProxy*); 52 52 void close(WebPageProxy*); 53 53 54 void runJavaScriptAlert(WebPageProxy*, const String&, WebFrameProxy*); 54 55 bool runJavaScriptConfirm(WebPageProxy*, const String&, WebFrameProxy*); 55 56 String runJavaScriptPrompt(WebPageProxy*, const String&, const String&, WebFrameProxy*); 57 56 58 void setStatusText(WebPageProxy*, const String&); 57 59 void mouseDidMoveOverElement(WebPageProxy*, WebEvent::Modifiers, APIObject*); 60 58 61 void contentsSizeChanged(WebPageProxy*, const WebCore::IntSize&, WebFrameProxy*); 59 62 void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&); … … 61 64 void setWindowFrame(WebPageProxy*, const WebCore::FloatRect&); 62 65 WebCore::FloatRect windowFrame(WebPageProxy*); 66 67 bool canRunBeforeUnloadConfirmPanel(); 68 bool runBeforeUnloadConfirmPanel(WebPageProxy*, const String&, WebFrameProxy*); 63 69 64 70 private: -
trunk/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r69457 r69460 205 205 bool WebChromeClient::canRunBeforeUnloadConfirmPanel() 206 206 { 207 notImplemented(); 208 return false; 207 bool canRun = false; 208 if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::CanRunBeforeUnloadConfirmPanel(), 209 Messages::WebPageProxy::CanRunBeforeUnloadConfirmPanel::Reply(canRun), 210 m_page->pageID(), CoreIPC::Connection::NoTimeout)) 211 return false; 212 213 return canRun; 209 214 } 210 215 211 216 bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) 212 217 { 213 notImplemented(); 214 return false; 218 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 219 220 bool shouldClose = false; 221 if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunBeforeUnloadConfirmPanel(message, webFrame->frameID()), 222 Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::Reply(shouldClose), 223 m_page->pageID(), CoreIPC::Connection::NoTimeout)) 224 return false; 225 226 return shouldClose; 215 227 } 216 228 -
trunk/WebKitTools/ChangeLog
r69457 r69460 1 2010-10-09 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Dan Bernstein. 4 5 Add WebKit2 version of runBeforeUnloadConfirmPanelWithMessage 6 <rdar://problem/8447690> 7 https://bugs.webkit.org/show_bug.cgi?id=47459 8 9 * MiniBrowser/mac/BrowserWindowController.m: 10 (runBeforeUnloadConfirmPanel): 11 (-[BrowserWindowController awakeFromNib]): 12 * WebKitTestRunner/TestController.cpp: 13 (WTR::createOtherPage): 14 (WTR::TestController::initialize): 15 1 16 2010-10-09 Sam Weinig <sam@webkit.org> 2 17 -
trunk/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
r69457 r69460 499 499 { 500 500 [[(BrowserWindowController *)clientInfo window] setFrame:CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height) display:YES]; 501 } 502 503 static bool runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo) 504 { 505 NSAlert *alert = [[NSAlert alloc] init]; 506 507 WKURLRef wkURL = WKFrameCopyURL(frame); 508 CFURLRef cfURL = WKURLCopyCFURL(0, wkURL); 509 WKRelease(wkURL); 510 511 [alert setMessageText:[NSString stringWithFormat:@"BeforeUnload confirm dialog from %@.", [(NSURL *)cfURL absoluteString]]]; 512 CFRelease(cfURL); 513 514 CFStringRef cfMessage = WKStringCopyCFString(0, message); 515 [alert setInformativeText:(NSString *)cfMessage]; 516 CFRelease(cfMessage); 517 518 [alert addButtonWithTitle:@"OK"]; 519 [alert addButtonWithTitle:@"Cancel"]; 520 521 NSInteger button = [alert runModal]; 522 [alert release]; 523 524 return button == NSAlertFirstButtonReturn; 501 525 } 502 526 … … 557 581 0, /* didNotHandleKeyEvent */ 558 582 getWindowFrame, 559 setWindowFrame 583 setWindowFrame, 584 runBeforeUnloadConfirmPanel 560 585 }; 561 586 WKPageSetPageUIClient(_webView.pageRef, &uiClient); -
trunk/WebKitTools/WebKitTestRunner/TestController.cpp
r69457 r69460 120 120 0, 121 121 getWindowFrameOtherPage, 122 setWindowFrameOtherPage 122 setWindowFrameOtherPage, 123 0 123 124 }; 124 125 WKPageSetPageUIClient(newPage, &otherPageUIClient); … … 203 204 0, 204 205 getWindowFrameMainPage, 205 setWindowFrameMainPage 206 setWindowFrameMainPage, 207 0, 206 208 }; 207 209 WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
Note: See TracChangeset
for help on using the changeset viewer.