| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 void ChromeClient::setWindowFeatures(const WindowFeatures& features) | 76 void ChromeClient::setWindowFeatures(const WindowFeatures& features) |
| 77 { | 77 { |
| 78 setToolbarsVisible(features.toolBarVisible || features.locationBarVisible); | 78 setToolbarsVisible(features.toolBarVisible || features.locationBarVisible); |
| 79 setStatusbarVisible(features.statusBarVisible); | 79 setStatusbarVisible(features.statusBarVisible); |
| 80 setScrollbarsVisible(features.scrollbarsVisible); | 80 setScrollbarsVisible(features.scrollbarsVisible); |
| 81 setMenubarVisible(features.menuBarVisible); | 81 setMenubarVisible(features.menuBarVisible); |
| 82 setResizable(features.resizable); | 82 setResizable(features.resizable); |
| 83 } | 83 } |
| 84 | 84 |
| 85 class ScopedJavaScriptDialogInstrumentation { |
| 86 STACK_ALLOCATED(); |
| 87 public: |
| 88 ScopedJavaScriptDialogInstrumentation(LocalFrame& frame, const String& messa
ge) |
| 89 : m_cookie(InspectorInstrumentation::willRunJavaScriptDialog(&frame, mes
sage)) |
| 90 { |
| 91 } |
| 92 ~ScopedJavaScriptDialogInstrumentation() |
| 93 { |
| 94 InspectorInstrumentation::didRunJavaScriptDialog(m_cookie); |
| 95 } |
| 96 |
| 97 private: |
| 98 InspectorInstrumentationCookie m_cookie; |
| 99 }; |
| 100 |
| 85 bool ChromeClient::runBeforeUnloadConfirmPanel(const String& message, LocalFrame
* frame) | 101 bool ChromeClient::runBeforeUnloadConfirmPanel(const String& message, LocalFrame
* frame) |
| 86 { | 102 { |
| 87 // Defer loads in case the client method runs a new event loop that would | 103 // Defer loads in case the client method runs a new event loop that would |
| 88 // otherwise cause the load to continue while we're in the middle of executi
ng JavaScript. | 104 // otherwise cause the load to continue while we're in the middle of executi
ng JavaScript. |
| 89 ScopedPageLoadDeferrer deferrer; | 105 ScopedPageLoadDeferrer deferrer; |
| 90 | 106 |
| 91 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav
aScriptDialog(frame, message); | 107 ScopedJavaScriptDialogInstrumentation instrumentation(*frame, message); |
| 92 bool ok = runBeforeUnloadConfirmPanelInternal(message, frame); | 108 return runBeforeUnloadConfirmPanelInternal(message, frame); |
| 93 InspectorInstrumentation::didRunJavaScriptDialog(cookie); | |
| 94 return ok; | |
| 95 } | 109 } |
| 96 | 110 |
| 97 void ChromeClient::runJavaScriptAlert(LocalFrame* frame, const String& message) | 111 void ChromeClient::runJavaScriptAlert(LocalFrame* frame, const String& message) |
| 98 { | 112 { |
| 99 if (!canRunModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Ale
rtDialog, message)) | 113 if (!canRunModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Ale
rtDialog, message)) |
| 100 return; | 114 return; |
| 101 | 115 |
| 102 // Defer loads in case the client method runs a new event loop that would | 116 // Defer loads in case the client method runs a new event loop that would |
| 103 // otherwise cause the load to continue while we're in the middle of executi
ng JavaScript. | 117 // otherwise cause the load to continue while we're in the middle of executi
ng JavaScript. |
| 104 ScopedPageLoadDeferrer deferrer; | 118 ScopedPageLoadDeferrer deferrer; |
| 105 | 119 |
| 106 ASSERT(frame); | 120 ASSERT(frame); |
| 107 notifyPopupOpeningObservers(); | 121 notifyPopupOpeningObservers(); |
| 108 | 122 |
| 109 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav
aScriptDialog(frame, message); | 123 ScopedJavaScriptDialogInstrumentation instrumentation(*frame, message); |
| 110 runJavaScriptAlertInternal(frame, message); | 124 runJavaScriptAlertInternal(frame, message); |
| 111 InspectorInstrumentation::didRunJavaScriptDialog(cookie); | |
| 112 } | 125 } |
| 113 | 126 |
| 114 bool ChromeClient::runJavaScriptConfirm(LocalFrame* frame, const String& message
) | 127 bool ChromeClient::runJavaScriptConfirm(LocalFrame* frame, const String& message
) |
| 115 { | 128 { |
| 116 if (!canRunModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Con
firmDialog, message)) | 129 if (!canRunModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Con
firmDialog, message)) |
| 117 return false; | 130 return false; |
| 118 | 131 |
| 119 // Defer loads in case the client method runs a new event loop that would | 132 // Defer loads in case the client method runs a new event loop that would |
| 120 // otherwise cause the load to continue while we're in the middle of executi
ng JavaScript. | 133 // otherwise cause the load to continue while we're in the middle of executi
ng JavaScript. |
| 121 ScopedPageLoadDeferrer deferrer; | 134 ScopedPageLoadDeferrer deferrer; |
| 122 | 135 |
| 123 ASSERT(frame); | 136 ASSERT(frame); |
| 124 notifyPopupOpeningObservers(); | 137 notifyPopupOpeningObservers(); |
| 125 | 138 |
| 126 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav
aScriptDialog(frame, message); | 139 ScopedJavaScriptDialogInstrumentation instrumentation(*frame, message); |
| 127 bool ok = runJavaScriptConfirmInternal(frame, message); | 140 return runJavaScriptConfirmInternal(frame, message); |
| 128 InspectorInstrumentation::didRunJavaScriptDialog(cookie); | |
| 129 return ok; | |
| 130 } | 141 } |
| 131 | 142 |
| 132 bool ChromeClient::runJavaScriptPrompt(LocalFrame* frame, const String& prompt,
const String& defaultValue, String& result) | 143 bool ChromeClient::runJavaScriptPrompt(LocalFrame* frame, const String& prompt,
const String& defaultValue, String& result) |
| 133 { | 144 { |
| 134 if (!canRunModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Pro
mptDialog, prompt)) | 145 if (!canRunModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Pro
mptDialog, prompt)) |
| 135 return false; | 146 return false; |
| 136 | 147 |
| 137 // Defer loads in case the client method runs a new event loop that would | 148 // Defer loads in case the client method runs a new event loop that would |
| 138 // otherwise cause the load to continue while we're in the middle of executi
ng JavaScript. | 149 // otherwise cause the load to continue while we're in the middle of executi
ng JavaScript. |
| 139 ScopedPageLoadDeferrer deferrer; | 150 ScopedPageLoadDeferrer deferrer; |
| 140 | 151 |
| 141 ASSERT(frame); | 152 ASSERT(frame); |
| 142 notifyPopupOpeningObservers(); | 153 notifyPopupOpeningObservers(); |
| 143 | 154 |
| 144 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav
aScriptDialog(frame, prompt); | 155 ScopedJavaScriptDialogInstrumentation instrumentation(*frame, prompt); |
| 145 bool ok = runJavaScriptPromptInternal(frame, prompt, defaultValue, result); | 156 return runJavaScriptPromptInternal(frame, prompt, defaultValue, result); |
| 146 InspectorInstrumentation::didRunJavaScriptDialog(cookie); | |
| 147 | |
| 148 return ok; | |
| 149 } | 157 } |
| 150 | 158 |
| 151 void ChromeClient::mouseDidMoveOverElement(const HitTestResult& result) | 159 void ChromeClient::mouseDidMoveOverElement(const HitTestResult& result) |
| 152 { | 160 { |
| 153 if (result.innerNode()) { | 161 if (result.innerNode()) { |
| 154 if (result.innerNode()->document().isDNSPrefetchEnabled()) | 162 if (result.innerNode()->document().isDNSPrefetchEnabled()) |
| 155 prefetchDNS(result.absoluteLinkURL().host()); | 163 prefetchDNS(result.absoluteLinkURL().host()); |
| 156 } | 164 } |
| 157 showMouseOverURL(result); | 165 showMouseOverURL(result); |
| 158 | 166 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 263 } |
| 256 | 264 |
| 257 void ChromeClient::notifyPopupOpeningObservers() const | 265 void ChromeClient::notifyPopupOpeningObservers() const |
| 258 { | 266 { |
| 259 const Vector<PopupOpeningObserver*> observers(m_popupOpeningObservers); | 267 const Vector<PopupOpeningObserver*> observers(m_popupOpeningObservers); |
| 260 for (size_t i = 0; i < observers.size(); ++i) | 268 for (size_t i = 0; i < observers.size(); ++i) |
| 261 observers[i]->willOpenPopup(); | 269 observers[i]->willOpenPopup(); |
| 262 } | 270 } |
| 263 | 271 |
| 264 } // namespace blink | 272 } // namespace blink |
| OLD | NEW |