OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 | 8 |
9 MSVC_PUSH_WARNING_LEVEL(0); | 9 MSVC_PUSH_WARNING_LEVEL(0); |
10 #include "Cursor.h" | 10 #include "Cursor.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 std::wstring wstr_message = webkit_glue::StringToStdWString(message); | 282 std::wstring wstr_message = webkit_glue::StringToStdWString(message); |
283 std::wstring wstr_source_id = webkit_glue::StringToStdWString(source_id); | 283 std::wstring wstr_source_id = webkit_glue::StringToStdWString(source_id); |
284 d->AddMessageToConsole(webview_, wstr_message, line_no, wstr_source_id); | 284 d->AddMessageToConsole(webview_, wstr_message, line_no, wstr_source_id); |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
288 bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() { | 288 bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() { |
289 return webview_->delegate() != NULL; | 289 return webview_->delegate() != NULL; |
290 } | 290 } |
291 | 291 |
292 bool ChromeClientImpl::runBeforeUnloadConfirmPanel(const WebCore::String& messag
e, | 292 bool ChromeClientImpl::runBeforeUnloadConfirmPanel( |
293 WebCore::Frame* frame) { | 293 const WebCore::String& message, |
| 294 WebCore::Frame* frame) { |
294 WebViewDelegate* d = webview_->delegate(); | 295 WebViewDelegate* d = webview_->delegate(); |
295 if (d) { | 296 if (d) { |
296 std::wstring wstr = webkit_glue::StringToStdWString(message); | 297 std::wstring wstr = webkit_glue::StringToStdWString(message); |
297 return d->RunBeforeUnloadConfirm(webview_, wstr); | 298 return d->RunBeforeUnloadConfirm(WebFrameImpl::FromFrame(frame), wstr); |
298 } | 299 } |
299 return false; | 300 return false; |
300 } | 301 } |
301 | 302 |
302 void ChromeClientImpl::closeWindowSoon() { | 303 void ChromeClientImpl::closeWindowSoon() { |
303 // Make sure this Page can no longer be found by JS. | 304 // Make sure this Page can no longer be found by JS. |
304 webview_->page()->setGroupName(WebCore::String()); | 305 webview_->page()->setGroupName(WebCore::String()); |
305 | 306 |
306 // Make sure that all loading is stopped. Ensures that JS stops executing! | 307 // Make sure that all loading is stopped. Ensures that JS stops executing! |
307 webview_->StopLoading(); | 308 webview_->StopLoading(); |
(...skipping 10 matching lines...) Expand all Loading... |
318 // Pass the request on to the WebView delegate, for more control. | 319 // Pass the request on to the WebView delegate, for more control. |
319 WebViewDelegate* d = webview_->delegate(); | 320 WebViewDelegate* d = webview_->delegate(); |
320 if (d) { | 321 if (d) { |
321 #if USE(V8) | 322 #if USE(V8) |
322 // Before showing the JavaScript dialog, we give the proxy implementation | 323 // Before showing the JavaScript dialog, we give the proxy implementation |
323 // a chance to process any pending console messages. | 324 // a chance to process any pending console messages. |
324 WebCore::V8Proxy::ProcessConsoleMessages(); | 325 WebCore::V8Proxy::ProcessConsoleMessages(); |
325 #endif | 326 #endif |
326 | 327 |
327 std::wstring wstr = webkit_glue::StringToStdWString(message); | 328 std::wstring wstr = webkit_glue::StringToStdWString(message); |
328 d->RunJavaScriptAlert(webview_, wstr); | 329 d->RunJavaScriptAlert(WebFrameImpl::FromFrame(frame), wstr); |
329 } | 330 } |
330 } | 331 } |
331 | 332 |
332 // See comments for runJavaScriptAlert(). | 333 // See comments for runJavaScriptAlert(). |
333 bool ChromeClientImpl::runJavaScriptConfirm(WebCore::Frame* frame, | 334 bool ChromeClientImpl::runJavaScriptConfirm(WebCore::Frame* frame, |
334 const WebCore::String& message) { | 335 const WebCore::String& message) { |
335 WebViewDelegate* d = webview_->delegate(); | 336 WebViewDelegate* d = webview_->delegate(); |
336 if (d) { | 337 if (d) { |
337 std::wstring wstr = webkit_glue::StringToStdWString(message); | 338 std::wstring wstr = webkit_glue::StringToStdWString(message); |
338 return d->RunJavaScriptConfirm(webview_, wstr); | 339 return d->RunJavaScriptConfirm(WebFrameImpl::FromFrame(frame), wstr); |
339 } | 340 } |
340 return false; | 341 return false; |
341 } | 342 } |
342 | 343 |
343 // See comments for runJavaScriptAlert(). | 344 // See comments for runJavaScriptAlert(). |
344 bool ChromeClientImpl::runJavaScriptPrompt(WebCore::Frame* frame, | 345 bool ChromeClientImpl::runJavaScriptPrompt(WebCore::Frame* frame, |
345 const WebCore::String& message, | 346 const WebCore::String& message, |
346 const WebCore::String& defaultValue, | 347 const WebCore::String& defaultValue, |
347 WebCore::String& result) { | 348 WebCore::String& result) { |
348 WebViewDelegate* d = webview_->delegate(); | 349 WebViewDelegate* d = webview_->delegate(); |
349 if (d) { | 350 if (d) { |
350 std::wstring wstr_message = webkit_glue::StringToStdWString(message); | 351 std::wstring wstr_message = webkit_glue::StringToStdWString(message); |
351 std::wstring wstr_default = webkit_glue::StringToStdWString(defaultValue); | 352 std::wstring wstr_default = webkit_glue::StringToStdWString(defaultValue); |
352 std::wstring wstr_result; | 353 std::wstring wstr_result; |
353 bool ok = d->RunJavaScriptPrompt(webview_, | 354 bool ok = d->RunJavaScriptPrompt(WebFrameImpl::FromFrame(frame), |
354 wstr_message, | 355 wstr_message, |
355 wstr_default, | 356 wstr_default, |
356 &wstr_result); | 357 &wstr_result); |
357 if (ok) | 358 if (ok) |
358 result = webkit_glue::StdWStringToString(wstr_result); | 359 result = webkit_glue::StdWStringToString(wstr_result); |
359 return ok; | 360 return ok; |
360 } | 361 } |
361 return false; | 362 return false; |
362 } | 363 } |
363 | 364 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 WebViewDelegate* d = webview_->delegate(); | 534 WebViewDelegate* d = webview_->delegate(); |
534 if (d) | 535 if (d) |
535 d->DisableSuddenTermination(); | 536 d->DisableSuddenTermination(); |
536 } | 537 } |
537 | 538 |
538 void ChromeClientImpl::formStateDidChange(const WebCore::Node*) { | 539 void ChromeClientImpl::formStateDidChange(const WebCore::Node*) { |
539 WebViewDelegate* d = webview_->delegate(); | 540 WebViewDelegate* d = webview_->delegate(); |
540 if (d) | 541 if (d) |
541 d->OnNavStateChanged(webview_); | 542 d->OnNavStateChanged(webview_); |
542 } | 543 } |
OLD | NEW |