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

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

Issue 964583002: Remove showModalDialog (Chrome side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
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 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 1495
1496 Send(new ViewHostMsg_UpdateState( 1496 Send(new ViewHostMsg_UpdateState(
1497 routing_id_, page_id_, HistoryEntryToPageState(entry))); 1497 routing_id_, page_id_, HistoryEntryToPageState(entry)));
1498 } 1498 }
1499 1499
1500 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { 1500 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) {
1501 // Before WebKit asks us to show an alert (etc.), it takes care of doing the 1501 // Before WebKit asks us to show an alert (etc.), it takes care of doing the
1502 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog 1502 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog
1503 // it is particularly important that we do not call willEnterModalLoop as 1503 // it is particularly important that we do not call willEnterModalLoop as
1504 // that would defer resource loads for the dialog itself. 1504 // that would defer resource loads for the dialog itself.
1505 // TODO(jochen): Now that we no longer support showModalDialog, see if we can
jam 2015/02/26 21:40:36 there are still other callers of this, so there's
1506 // simplify this logic.
1505 if (RenderThreadImpl::current()) // Will be NULL during unit tests. 1507 if (RenderThreadImpl::current()) // Will be NULL during unit tests.
1506 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); 1508 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop();
1507 1509
1508 message->EnableMessagePumping(); // Runs a nested message loop. 1510 message->EnableMessagePumping(); // Runs a nested message loop.
1509 return Send(message); 1511 return Send(message);
1510 } 1512 }
1511 1513
1512 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { 1514 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) {
1513 int id = next_snapshot_id_++; 1515 int id = next_snapshot_id_++;
1514 pending_snapshots_.insert(std::make_pair(id, callback)); 1516 pending_snapshots_.insert(std::make_pair(id, callback));
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 2020
2019 // NOTE: initial_rect_ may still have its default values at this point, but 2021 // NOTE: initial_rect_ may still have its default values at this point, but
2020 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the 2022 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the
2021 // browser process will impose a default position otherwise. 2023 // browser process will impose a default position otherwise.
2022 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, 2024 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_,
2023 NavigationPolicyToDisposition(policy), initial_rect_, 2025 NavigationPolicyToDisposition(policy), initial_rect_,
2024 opened_by_user_gesture_)); 2026 opened_by_user_gesture_));
2025 SetPendingWindowRect(initial_rect_); 2027 SetPendingWindowRect(initial_rect_);
2026 } 2028 }
2027 2029
2028 void RenderViewImpl::runModal() {
2029 DCHECK(did_show_) << "should already have shown the view";
2030
2031 // Don't allow further dialogs if we are waiting to swap out, since the
2032 // PageGroupLoadDeferrer in our stack prevents it.
2033 if (suppress_dialogs_until_swap_out_)
2034 return;
2035
2036 // We must keep WebKit's shared timer running in this case in order to allow
2037 // showModalDialog to function properly.
2038 //
2039 // TODO(darin): WebKit should really be smarter about suppressing events and
2040 // timers so that we do not need to manage the shared timer in such a heavy
2041 // handed manner.
2042 //
2043 if (RenderThreadImpl::current()) // Will be NULL during unit tests.
2044 RenderThreadImpl::current()->DoNotSuspendWebKitSharedTimer();
2045
2046 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(
2047 routing_id_, opener_id_));
2048 }
2049
2050 bool RenderViewImpl::requestPointerLock() { 2030 bool RenderViewImpl::requestPointerLock() {
2051 return mouse_lock_dispatcher_->LockMouse(webwidget_mouse_lock_target_.get()); 2031 return mouse_lock_dispatcher_->LockMouse(webwidget_mouse_lock_target_.get());
2052 } 2032 }
2053 2033
2054 void RenderViewImpl::requestPointerUnlock() { 2034 void RenderViewImpl::requestPointerUnlock() {
2055 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); 2035 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get());
2056 } 2036 }
2057 2037
2058 bool RenderViewImpl::isPointerLocked() { 2038 bool RenderViewImpl::isPointerLocked() {
2059 return mouse_lock_dispatcher_->IsMouseLockedTo( 2039 return mouse_lock_dispatcher_->IsMouseLockedTo(
(...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after
4059 std::vector<gfx::Size> sizes; 4039 std::vector<gfx::Size> sizes;
4060 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4040 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4061 if (!url.isEmpty()) 4041 if (!url.isEmpty())
4062 urls.push_back( 4042 urls.push_back(
4063 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4043 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4064 } 4044 }
4065 SendUpdateFaviconURL(urls); 4045 SendUpdateFaviconURL(urls);
4066 } 4046 }
4067 4047
4068 } // namespace content 4048 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698