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

Side by Side Diff: third_party/WebKit/Source/core/page/ChromeClient.cpp

Issue 2863203002: Ignore print() during page dismissal. (Closed)
Patch Set: rebase, addressing comments Created 3 years, 7 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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2012, Samsung Electronics. All rights reserved. 4 * Copyright (C) 2012, Samsung Electronics. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 11 matching lines...) Expand all
22 #include "core/page/ChromeClient.h" 22 #include "core/page/ChromeClient.h"
23 23
24 #include <algorithm> 24 #include <algorithm>
25 #include "core/dom/Document.h" 25 #include "core/dom/Document.h"
26 #include "core/dom/Element.h" 26 #include "core/dom/Element.h"
27 #include "core/frame/FrameConsole.h" 27 #include "core/frame/FrameConsole.h"
28 #include "core/frame/LocalFrame.h" 28 #include "core/frame/LocalFrame.h"
29 #include "core/inspector/ConsoleMessage.h" 29 #include "core/inspector/ConsoleMessage.h"
30 #include "core/layout/HitTestResult.h" 30 #include "core/layout/HitTestResult.h"
31 #include "core/page/FrameTree.h" 31 #include "core/page/FrameTree.h"
32 #include "core/page/Page.h"
32 #include "core/page/ScopedPageSuspender.h" 33 #include "core/page/ScopedPageSuspender.h"
33 #include "core/page/WindowFeatures.h" 34 #include "core/page/WindowFeatures.h"
34 #include "core/probe/CoreProbes.h" 35 #include "core/probe/CoreProbes.h"
35 #include "platform/geometry/IntRect.h" 36 #include "platform/geometry/IntRect.h"
36 #include "platform/network/NetworkHints.h" 37 #include "platform/network/NetworkHints.h"
37 #include "public/platform/WebScreenInfo.h" 38 #include "public/platform/WebScreenInfo.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 DEFINE_TRACE(ChromeClient) { 42 DEFINE_TRACE(ChromeClient) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 SetToolTip(frame, tool_tip, tool_tip_direction); 216 SetToolTip(frame, tool_tip, tool_tip_direction);
216 } 217 }
217 218
218 void ChromeClient::ClearToolTip(LocalFrame& frame) { 219 void ChromeClient::ClearToolTip(LocalFrame& frame) {
219 // Do not check m_lastToolTip* and do not update them intentionally. 220 // Do not check m_lastToolTip* and do not update them intentionally.
220 // We don't want to show tooltips with same content after clearToolTip(). 221 // We don't want to show tooltips with same content after clearToolTip().
221 SetToolTip(frame, String(), TextDirection::kLtr); 222 SetToolTip(frame, String(), TextDirection::kLtr);
222 } 223 }
223 224
224 bool ChromeClient::Print(LocalFrame* frame) { 225 bool ChromeClient::Print(LocalFrame* frame) {
226 if (!CanOpenModalIfDuringPageDismissal(*frame->GetPage()->MainFrame(),
227 ChromeClient::kPrintDialog, "")) {
228 return false;
229 }
230
225 if (frame->GetDocument()->IsSandboxed(kSandboxModals)) { 231 if (frame->GetDocument()->IsSandboxed(kSandboxModals)) {
226 UseCounter::Count(frame, UseCounter::kDialogInSandboxedContext); 232 UseCounter::Count(frame, UseCounter::kDialogInSandboxedContext);
227 frame->Console().AddMessage(ConsoleMessage::Create( 233 frame->Console().AddMessage(ConsoleMessage::Create(
228 kSecurityMessageSource, kErrorMessageLevel, 234 kSecurityMessageSource, kErrorMessageLevel,
229 "Ignored call to 'print()'. The document is sandboxed, and the " 235 "Ignored call to 'print()'. The document is sandboxed, and the "
230 "'allow-modals' keyword is not set.")); 236 "'allow-modals' keyword is not set."));
231 return false; 237 return false;
232 } 238 }
233 239
234 // Suspend pages in case the client method runs a new event loop that would 240 // Suspend pages in case the client method runs a new event loop that would
235 // otherwise cause the load to continue while we're in the middle of 241 // otherwise cause the load to continue while we're in the middle of
236 // executing JavaScript. 242 // executing JavaScript.
237 ScopedPageSuspender suspender; 243 ScopedPageSuspender suspender;
238 244
239 PrintDelegate(frame); 245 PrintDelegate(frame);
240 return true; 246 return true;
241 } 247 }
242 248
243 } // namespace blink 249 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/ChromeClient.h ('k') | third_party/WebKit/Source/web/ChromeClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698