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 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( | 1573 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( |
1574 routing_id_, message, default_value, frame_url, type, &success, result)); | 1574 routing_id_, message, default_value, frame_url, type, &success, result)); |
1575 return success; | 1575 return success; |
1576 } | 1576 } |
1577 | 1577 |
1578 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { | 1578 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { |
1579 // Before WebKit asks us to show an alert (etc.), it takes care of doing the | 1579 // Before WebKit asks us to show an alert (etc.), it takes care of doing the |
1580 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog | 1580 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog |
1581 // it is particularly important that we do not call willEnterModalLoop as | 1581 // it is particularly important that we do not call willEnterModalLoop as |
1582 // that would defer resource loads for the dialog itself. | 1582 // that would defer resource loads for the dialog itself. |
1583 // TODO(jamesr): Now that we no longer support showModalDialog, see if we can | |
1584 // simplify this logic. | |
1585 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 1583 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
1586 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); | 1584 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); |
1587 | 1585 |
1588 message->EnableMessagePumping(); // Runs a nested message loop. | 1586 message->EnableMessagePumping(); // Runs a nested message loop. |
1589 return Send(message); | 1587 return Send(message); |
1590 } | 1588 } |
1591 | 1589 |
1592 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { | 1590 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { |
1593 int id = next_snapshot_id_++; | 1591 int id = next_snapshot_id_++; |
1594 pending_snapshots_.insert(std::make_pair(id, callback)); | 1592 pending_snapshots_.insert(std::make_pair(id, callback)); |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 | 2254 |
2257 // NOTE: initial_pos_ may still have its default values at this point, but | 2255 // NOTE: initial_pos_ may still have its default values at this point, but |
2258 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the | 2256 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the |
2259 // browser process will impose a default position otherwise. | 2257 // browser process will impose a default position otherwise. |
2260 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, | 2258 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, |
2261 NavigationPolicyToDisposition(policy), initial_pos_, | 2259 NavigationPolicyToDisposition(policy), initial_pos_, |
2262 opened_by_user_gesture_)); | 2260 opened_by_user_gesture_)); |
2263 SetPendingWindowRect(initial_pos_); | 2261 SetPendingWindowRect(initial_pos_); |
2264 } | 2262 } |
2265 | 2263 |
| 2264 void RenderViewImpl::runModal() { |
| 2265 DCHECK(did_show_) << "should already have shown the view"; |
| 2266 |
| 2267 // Don't allow further dialogs if we are waiting to swap out, since the |
| 2268 // PageGroupLoadDeferrer in our stack prevents it. |
| 2269 if (suppress_dialogs_until_swap_out_) |
| 2270 return; |
| 2271 |
| 2272 // We must keep WebKit's shared timer running in this case in order to allow |
| 2273 // showModalDialog to function properly. |
| 2274 // |
| 2275 // TODO(darin): WebKit should really be smarter about suppressing events and |
| 2276 // timers so that we do not need to manage the shared timer in such a heavy |
| 2277 // handed manner. |
| 2278 // |
| 2279 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
| 2280 RenderThreadImpl::current()->DoNotSuspendWebKitSharedTimer(); |
| 2281 |
| 2282 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal( |
| 2283 routing_id_, opener_id_)); |
| 2284 } |
| 2285 |
2266 bool RenderViewImpl::enterFullScreen() { | 2286 bool RenderViewImpl::enterFullScreen() { |
2267 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true)); | 2287 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true)); |
2268 return true; | 2288 return true; |
2269 } | 2289 } |
2270 | 2290 |
2271 void RenderViewImpl::exitFullScreen() { | 2291 void RenderViewImpl::exitFullScreen() { |
2272 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false)); | 2292 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false)); |
2273 } | 2293 } |
2274 | 2294 |
2275 bool RenderViewImpl::requestPointerLock() { | 2295 bool RenderViewImpl::requestPointerLock() { |
(...skipping 2839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5115 for (size_t i = 0; i < icon_urls.size(); i++) { | 5135 for (size_t i = 0; i < icon_urls.size(); i++) { |
5116 WebURL url = icon_urls[i].iconURL(); | 5136 WebURL url = icon_urls[i].iconURL(); |
5117 if (!url.isEmpty()) | 5137 if (!url.isEmpty()) |
5118 urls.push_back(FaviconURL(url, | 5138 urls.push_back(FaviconURL(url, |
5119 ToFaviconType(icon_urls[i].iconType()))); | 5139 ToFaviconType(icon_urls[i].iconType()))); |
5120 } | 5140 } |
5121 SendUpdateFaviconURL(urls); | 5141 SendUpdateFaviconURL(urls); |
5122 } | 5142 } |
5123 | 5143 |
5124 } // namespace content | 5144 } // namespace content |
OLD | NEW |