| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2012, Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2012, Samsung Electronics. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 window.setWidth(std::min(std::max(minimumSize.width(), window.width()),
screen.width())); | 49 window.setWidth(std::min(std::max(minimumSize.width(), window.width()),
screen.width())); |
| 50 if (window.height()) | 50 if (window.height()) |
| 51 window.setHeight(std::min(std::max(minimumSize.height(), window.height()
), screen.height())); | 51 window.setHeight(std::min(std::max(minimumSize.height(), window.height()
), screen.height())); |
| 52 | 52 |
| 53 // Constrain the window position within the valid screen area. | 53 // Constrain the window position within the valid screen area. |
| 54 window.setX(std::max(screen.x(), std::min(window.x(), screen.maxX() - window
.width()))); | 54 window.setX(std::max(screen.x(), std::min(window.x(), screen.maxX() - window
.width()))); |
| 55 window.setY(std::max(screen.y(), std::min(window.y(), screen.maxY() - window
.height()))); | 55 window.setY(std::max(screen.y(), std::min(window.y(), screen.maxY() - window
.height()))); |
| 56 setWindowRect(window); | 56 setWindowRect(window); |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool ChromeClient::canRunModalIfDuringPageDismissal(Frame* mainFrame, ChromeClie
nt::DialogType dialog, const String& message) | 59 bool ChromeClient::canOpenModalIfDuringPageDismissal(Frame* mainFrame, ChromeCli
ent::DialogType dialog, const String& message) |
| 60 { | 60 { |
| 61 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext())
{ | 61 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext())
{ |
| 62 if (!frame->isLocalFrame()) | 62 if (!frame->isLocalFrame()) |
| 63 continue; | 63 continue; |
| 64 Document::PageDismissalType dismissal = toLocalFrame(frame)->document()-
>pageDismissalEventBeingDispatched(); | 64 Document::PageDismissalType dismissal = toLocalFrame(frame)->document()-
>pageDismissalEventBeingDispatched(); |
| 65 if (dismissal != Document::NoDismissal) | 65 if (dismissal != Document::NoDismissal) |
| 66 return shouldRunModalDialogDuringPageDismissal(dialog, message, dism
issal); | 66 return shouldOpenModalDialogDuringPageDismissal(dialog, message, dis
missal); |
| 67 } | 67 } |
| 68 return true; | 68 return true; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void ChromeClient::setWindowFeatures(const WindowFeatures& features) | 71 void ChromeClient::setWindowFeatures(const WindowFeatures& features) |
| 72 { | 72 { |
| 73 setToolbarsVisible(features.toolBarVisible || features.locationBarVisible); | 73 setToolbarsVisible(features.toolBarVisible || features.locationBarVisible); |
| 74 setStatusbarVisible(features.statusBarVisible); | 74 setStatusbarVisible(features.statusBarVisible); |
| 75 setScrollbarsVisible(features.scrollbarsVisible); | 75 setScrollbarsVisible(features.scrollbarsVisible); |
| 76 setMenubarVisible(features.menuBarVisible); | 76 setMenubarVisible(features.menuBarVisible); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 103 { | 103 { |
| 104 // Defer loads in case the client method runs a new event loop that would | 104 // Defer loads in case the client method runs a new event loop that would |
| 105 // otherwise cause the load to continue while we're in the middle of | 105 // otherwise cause the load to continue while we're in the middle of |
| 106 // executing JavaScript. | 106 // executing JavaScript. |
| 107 ScopedPageLoadDeferrer deferrer; | 107 ScopedPageLoadDeferrer deferrer; |
| 108 | 108 |
| 109 ScopedJavaScriptDialogInstrumentation instrumentation(frame, message); | 109 ScopedJavaScriptDialogInstrumentation instrumentation(frame, message); |
| 110 return (chromeClient->*function)(&frame, message, parameters...); | 110 return (chromeClient->*function)(&frame, message, parameters...); |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool ChromeClient::runBeforeUnloadConfirmPanel(const String& message, LocalFrame
* frame) | 113 bool ChromeClient::openBeforeUnloadConfirmPanel(const String& message, LocalFram
e* frame) |
| 114 { | 114 { |
| 115 return openJavaScriptDialog(this, &ChromeClient::runBeforeUnloadConfirmPanel
Internal, *frame, message); | 115 return openJavaScriptDialog(this, &ChromeClient::openBeforeUnloadConfirmPane
lDelegate, *frame, message); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void ChromeClient::runJavaScriptAlert(LocalFrame* frame, const String& message) | 118 void ChromeClient::openJavaScriptAlert(LocalFrame* frame, const String& message) |
| 119 { | 119 { |
| 120 ASSERT(frame); | 120 ASSERT(frame); |
| 121 if (!canRunModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Ale
rtDialog, message)) | 121 if (!canOpenModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Al
ertDialog, message)) |
| 122 return; | 122 return; |
| 123 openJavaScriptDialog(this, &ChromeClient::runJavaScriptAlertInternal, *frame
, message); | 123 openJavaScriptDialog(this, &ChromeClient::openJavaScriptAlertDelegate, *fram
e, message); |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool ChromeClient::runJavaScriptConfirm(LocalFrame* frame, const String& message
) | 126 bool ChromeClient::openJavaScriptConfirm(LocalFrame* frame, const String& messag
e) |
| 127 { | 127 { |
| 128 ASSERT(frame); | 128 ASSERT(frame); |
| 129 if (!canRunModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Con
firmDialog, message)) | 129 if (!canOpenModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Co
nfirmDialog, message)) |
| 130 return false; | 130 return false; |
| 131 return openJavaScriptDialog(this, &ChromeClient::runJavaScriptConfirmInterna
l, *frame, message); | 131 return openJavaScriptDialog(this, &ChromeClient::openJavaScriptConfirmDelega
te, *frame, message); |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool ChromeClient::runJavaScriptPrompt(LocalFrame* frame, const String& prompt,
const String& defaultValue, String& result) | 134 bool ChromeClient::openJavaScriptPrompt(LocalFrame* frame, const String& prompt,
const String& defaultValue, String& result) |
| 135 { | 135 { |
| 136 ASSERT(frame); | 136 ASSERT(frame); |
| 137 if (!canRunModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Pro
mptDialog, prompt)) | 137 if (!canOpenModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Pr
omptDialog, prompt)) |
| 138 return false; | 138 return false; |
| 139 return openJavaScriptDialog(this, &ChromeClient::runJavaScriptPromptInternal
, *frame, prompt, defaultValue, result); | 139 return openJavaScriptDialog(this, &ChromeClient::openJavaScriptPromptDelegat
e, *frame, prompt, defaultValue, result); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void ChromeClient::mouseDidMoveOverElement(const HitTestResult& result) | 142 void ChromeClient::mouseDidMoveOverElement(const HitTestResult& result) |
| 143 { | 143 { |
| 144 if (result.innerNode() && result.innerNode()->document().isDNSPrefetchEnable
d()) | 144 if (result.innerNode() && result.innerNode()->document().isDNSPrefetchEnable
d()) |
| 145 prefetchDNS(result.absoluteLinkURL().host()); | 145 prefetchDNS(result.absoluteLinkURL().host()); |
| 146 | 146 |
| 147 showMouseOverURL(result); | 147 showMouseOverURL(result); |
| 148 | 148 |
| 149 setToolTip(result); | 149 setToolTip(result); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 setToolTip(toolTip, toolTipDirection); | 181 setToolTip(toolTip, toolTipDirection); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void ChromeClient::print(LocalFrame* frame) | 184 void ChromeClient::print(LocalFrame* frame) |
| 185 { | 185 { |
| 186 // Defer loads in case the client method runs a new event loop that would | 186 // Defer loads in case the client method runs a new event loop that would |
| 187 // otherwise cause the load to continue while we're in the middle of | 187 // otherwise cause the load to continue while we're in the middle of |
| 188 // executing JavaScript. | 188 // executing JavaScript. |
| 189 ScopedPageLoadDeferrer deferrer; | 189 ScopedPageLoadDeferrer deferrer; |
| 190 | 190 |
| 191 printInternal(frame); | 191 printDelegate(frame); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace blink | 194 } // namespace blink |
| OLD | NEW |