OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( | 1709 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( |
1710 routing_id_, message, default_value, frame_url, type, &success, result)); | 1710 routing_id_, message, default_value, frame_url, type, &success, result)); |
1711 return success; | 1711 return success; |
1712 } | 1712 } |
1713 | 1713 |
1714 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { | 1714 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { |
1715 // Before WebKit asks us to show an alert (etc.), it takes care of doing the | 1715 // Before WebKit asks us to show an alert (etc.), it takes care of doing the |
1716 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog | 1716 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog |
1717 // it is particularly important that we do not call willEnterModalLoop as | 1717 // it is particularly important that we do not call willEnterModalLoop as |
1718 // that would defer resource loads for the dialog itself. | 1718 // that would defer resource loads for the dialog itself. |
| 1719 // TODO(jamesr): Now that we no longer support showModalDialog, see if we can |
| 1720 // simplify this logic. |
1719 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 1721 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
1720 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); | 1722 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); |
1721 | 1723 |
1722 message->EnableMessagePumping(); // Runs a nested message loop. | 1724 message->EnableMessagePumping(); // Runs a nested message loop. |
1723 return Send(message); | 1725 return Send(message); |
1724 } | 1726 } |
1725 | 1727 |
1726 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { | 1728 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { |
1727 int id = next_snapshot_id_++; | 1729 int id = next_snapshot_id_++; |
1728 pending_snapshots_.insert(std::make_pair(id, callback)); | 1730 pending_snapshots_.insert(std::make_pair(id, callback)); |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2416 | 2418 |
2417 // NOTE: initial_pos_ may still have its default values at this point, but | 2419 // NOTE: initial_pos_ may still have its default values at this point, but |
2418 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the | 2420 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the |
2419 // browser process will impose a default position otherwise. | 2421 // browser process will impose a default position otherwise. |
2420 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, | 2422 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, |
2421 NavigationPolicyToDisposition(policy), initial_pos_, | 2423 NavigationPolicyToDisposition(policy), initial_pos_, |
2422 opened_by_user_gesture_)); | 2424 opened_by_user_gesture_)); |
2423 SetPendingWindowRect(initial_pos_); | 2425 SetPendingWindowRect(initial_pos_); |
2424 } | 2426 } |
2425 | 2427 |
2426 void RenderViewImpl::runModal() { | |
2427 DCHECK(did_show_) << "should already have shown the view"; | |
2428 | |
2429 // Don't allow further dialogs if we are waiting to swap out, since the | |
2430 // PageGroupLoadDeferrer in our stack prevents it. | |
2431 if (suppress_dialogs_until_swap_out_) | |
2432 return; | |
2433 | |
2434 // We must keep WebKit's shared timer running in this case in order to allow | |
2435 // showModalDialog to function properly. | |
2436 // | |
2437 // TODO(darin): WebKit should really be smarter about suppressing events and | |
2438 // timers so that we do not need to manage the shared timer in such a heavy | |
2439 // handed manner. | |
2440 // | |
2441 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | |
2442 RenderThreadImpl::current()->DoNotSuspendWebKitSharedTimer(); | |
2443 | |
2444 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal( | |
2445 routing_id_, opener_id_)); | |
2446 } | |
2447 | |
2448 bool RenderViewImpl::enterFullScreen() { | 2428 bool RenderViewImpl::enterFullScreen() { |
2449 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true)); | 2429 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true)); |
2450 return true; | 2430 return true; |
2451 } | 2431 } |
2452 | 2432 |
2453 void RenderViewImpl::exitFullScreen() { | 2433 void RenderViewImpl::exitFullScreen() { |
2454 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false)); | 2434 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false)); |
2455 } | 2435 } |
2456 | 2436 |
2457 bool RenderViewImpl::requestPointerLock() { | 2437 bool RenderViewImpl::requestPointerLock() { |
(...skipping 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5547 for (size_t i = 0; i < icon_urls.size(); i++) { | 5527 for (size_t i = 0; i < icon_urls.size(); i++) { |
5548 WebURL url = icon_urls[i].iconURL(); | 5528 WebURL url = icon_urls[i].iconURL(); |
5549 if (!url.isEmpty()) | 5529 if (!url.isEmpty()) |
5550 urls.push_back(FaviconURL(url, | 5530 urls.push_back(FaviconURL(url, |
5551 ToFaviconType(icon_urls[i].iconType()))); | 5531 ToFaviconType(icon_urls[i].iconType()))); |
5552 } | 5532 } |
5553 SendUpdateFaviconURL(urls); | 5533 SendUpdateFaviconURL(urls); |
5554 } | 5534 } |
5555 | 5535 |
5556 } // namespace content | 5536 } // namespace content |
OLD | NEW |