Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(883)

Side by Side Diff: trunk/src/content/renderer/render_view_impl.cc

Issue 177263002: Revert 252883 "Remove tests and code for showModalDialog" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( 1707 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage(
1708 routing_id_, message, default_value, frame_url, type, &success, result)); 1708 routing_id_, message, default_value, frame_url, type, &success, result));
1709 return success; 1709 return success;
1710 } 1710 }
1711 1711
1712 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { 1712 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) {
1713 // Before WebKit asks us to show an alert (etc.), it takes care of doing the 1713 // Before WebKit asks us to show an alert (etc.), it takes care of doing the
1714 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog 1714 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog
1715 // it is particularly important that we do not call willEnterModalLoop as 1715 // it is particularly important that we do not call willEnterModalLoop as
1716 // that would defer resource loads for the dialog itself. 1716 // that would defer resource loads for the dialog itself.
1717 // TODO(jamesr): Now that we no longer support showModalDialog, see if we can
1718 // simplify this logic.
1719 if (RenderThreadImpl::current()) // Will be NULL during unit tests. 1717 if (RenderThreadImpl::current()) // Will be NULL during unit tests.
1720 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); 1718 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop();
1721 1719
1722 message->EnableMessagePumping(); // Runs a nested message loop. 1720 message->EnableMessagePumping(); // Runs a nested message loop.
1723 return Send(message); 1721 return Send(message);
1724 } 1722 }
1725 1723
1726 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { 1724 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) {
1727 int id = next_snapshot_id_++; 1725 int id = next_snapshot_id_++;
1728 pending_snapshots_.insert(std::make_pair(id, callback)); 1726 pending_snapshots_.insert(std::make_pair(id, callback));
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 2415
2418 // NOTE: initial_pos_ may still have its default values at this point, but 2416 // NOTE: initial_pos_ may still have its default values at this point, but
2419 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the 2417 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the
2420 // browser process will impose a default position otherwise. 2418 // browser process will impose a default position otherwise.
2421 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, 2419 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_,
2422 NavigationPolicyToDisposition(policy), initial_pos_, 2420 NavigationPolicyToDisposition(policy), initial_pos_,
2423 opened_by_user_gesture_)); 2421 opened_by_user_gesture_));
2424 SetPendingWindowRect(initial_pos_); 2422 SetPendingWindowRect(initial_pos_);
2425 } 2423 }
2426 2424
2425 void RenderViewImpl::runModal() {
2426 DCHECK(did_show_) << "should already have shown the view";
2427
2428 // Don't allow further dialogs if we are waiting to swap out, since the
2429 // PageGroupLoadDeferrer in our stack prevents it.
2430 if (suppress_dialogs_until_swap_out_)
2431 return;
2432
2433 // We must keep WebKit's shared timer running in this case in order to allow
2434 // showModalDialog to function properly.
2435 //
2436 // TODO(darin): WebKit should really be smarter about suppressing events and
2437 // timers so that we do not need to manage the shared timer in such a heavy
2438 // handed manner.
2439 //
2440 if (RenderThreadImpl::current()) // Will be NULL during unit tests.
2441 RenderThreadImpl::current()->DoNotSuspendWebKitSharedTimer();
2442
2443 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(
2444 routing_id_, opener_id_));
2445 }
2446
2427 bool RenderViewImpl::enterFullScreen() { 2447 bool RenderViewImpl::enterFullScreen() {
2428 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true)); 2448 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true));
2429 return true; 2449 return true;
2430 } 2450 }
2431 2451
2432 void RenderViewImpl::exitFullScreen() { 2452 void RenderViewImpl::exitFullScreen() {
2433 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false)); 2453 Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false));
2434 } 2454 }
2435 2455
2436 bool RenderViewImpl::requestPointerLock() { 2456 bool RenderViewImpl::requestPointerLock() {
(...skipping 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after
5523 for (size_t i = 0; i < icon_urls.size(); i++) { 5543 for (size_t i = 0; i < icon_urls.size(); i++) {
5524 WebURL url = icon_urls[i].iconURL(); 5544 WebURL url = icon_urls[i].iconURL();
5525 if (!url.isEmpty()) 5545 if (!url.isEmpty())
5526 urls.push_back(FaviconURL(url, 5546 urls.push_back(FaviconURL(url,
5527 ToFaviconType(icon_urls[i].iconType()))); 5547 ToFaviconType(icon_urls[i].iconType())));
5528 } 5548 }
5529 SendUpdateFaviconURL(urls); 5549 SendUpdateFaviconURL(urls);
5530 } 5550 }
5531 5551
5532 } // namespace content 5552 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/renderer/render_view_impl.h ('k') | trunk/src/content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698