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

Side by Side Diff: Source/core/page/Chrome.cpp

Issue 172513002: Rename PageGroupLoadDeferrer to ScopedPageLoadDeferrer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/page/EventSource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 13 matching lines...) Expand all
24 24
25 #include "public/platform/WebScreenInfo.h" 25 #include "public/platform/WebScreenInfo.h"
26 #include "HTMLNames.h" 26 #include "HTMLNames.h"
27 #include "core/dom/Document.h" 27 #include "core/dom/Document.h"
28 #include "core/html/HTMLInputElement.h" 28 #include "core/html/HTMLInputElement.h"
29 #include "core/inspector/InspectorInstrumentation.h" 29 #include "core/inspector/InspectorInstrumentation.h"
30 #include "core/page/ChromeClient.h" 30 #include "core/page/ChromeClient.h"
31 #include "core/frame/Frame.h" 31 #include "core/frame/Frame.h"
32 #include "core/page/FrameTree.h" 32 #include "core/page/FrameTree.h"
33 #include "core/page/Page.h" 33 #include "core/page/Page.h"
34 #include "core/page/PageGroupLoadDeferrer.h"
35 #include "core/page/PopupOpeningObserver.h" 34 #include "core/page/PopupOpeningObserver.h"
35 #include "core/page/ScopedPageLoadDeferrer.h"
36 #include "core/page/WindowFeatures.h" 36 #include "core/page/WindowFeatures.h"
37 #include "core/rendering/HitTestResult.h" 37 #include "core/rendering/HitTestResult.h"
38 #include "platform/ColorChooser.h" 38 #include "platform/ColorChooser.h"
39 #include "platform/DateTimeChooser.h" 39 #include "platform/DateTimeChooser.h"
40 #include "platform/FileChooser.h" 40 #include "platform/FileChooser.h"
41 #include "platform/geometry/FloatRect.h" 41 #include "platform/geometry/FloatRect.h"
42 #include "platform/network/DNS.h" 42 #include "platform/network/DNS.h"
43 #include "wtf/PassRefPtr.h" 43 #include "wtf/PassRefPtr.h"
44 #include "wtf/Vector.h" 44 #include "wtf/Vector.h"
45 45
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return true; 150 return true;
151 } 151 }
152 152
153 bool Chrome::canRunModalNow() const 153 bool Chrome::canRunModalNow() const
154 { 154 {
155 return canRunModal() && canRunModalIfDuringPageDismissal(m_page, ChromeClien t::HTMLDialog, String()); 155 return canRunModal() && canRunModalIfDuringPageDismissal(m_page, ChromeClien t::HTMLDialog, String());
156 } 156 }
157 157
158 void Chrome::runModal() const 158 void Chrome::runModal() const
159 { 159 {
160 // Defer callbacks in all the other pages in this group, so we don't try to run JavaScript 160 // Defer callbacks in all the other pages, so we don't try to run JavaScript
161 // in a way that could interact with this view. 161 // in a way that could interact with this view.
162 PageGroupLoadDeferrer deferrer(m_page, false); 162 ScopedPageLoadDeferrer deferrer(m_page);
163 163
164 TimerBase::fireTimersInNestedEventLoop(); 164 TimerBase::fireTimersInNestedEventLoop();
165 m_client->runModal(); 165 m_client->runModal();
166 } 166 }
167 167
168 void Chrome::setWindowFeatures(const WindowFeatures& features) const 168 void Chrome::setWindowFeatures(const WindowFeatures& features) const
169 { 169 {
170 m_client->setToolbarsVisible(features.toolBarVisible || features.locationBar Visible); 170 m_client->setToolbarsVisible(features.toolBarVisible || features.locationBar Visible);
171 m_client->setStatusbarVisible(features.statusBarVisible); 171 m_client->setStatusbarVisible(features.statusBarVisible);
172 m_client->setScrollbarsVisible(features.scrollbarsVisible); 172 m_client->setScrollbarsVisible(features.scrollbarsVisible);
(...skipping 23 matching lines...) Expand all
196 196
197 bool Chrome::canRunBeforeUnloadConfirmPanel() 197 bool Chrome::canRunBeforeUnloadConfirmPanel()
198 { 198 {
199 return m_client->canRunBeforeUnloadConfirmPanel(); 199 return m_client->canRunBeforeUnloadConfirmPanel();
200 } 200 }
201 201
202 bool Chrome::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) 202 bool Chrome::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
203 { 203 {
204 // Defer loads in case the client method runs a new event loop that would 204 // Defer loads in case the client method runs a new event loop that would
205 // otherwise cause the load to continue while we're in the middle of executi ng JavaScript. 205 // otherwise cause the load to continue while we're in the middle of executi ng JavaScript.
206 PageGroupLoadDeferrer deferrer(m_page, true); 206 ScopedPageLoadDeferrer deferrer;
207 207
208 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav aScriptDialog(m_page, message); 208 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav aScriptDialog(m_page, message);
209 bool ok = m_client->runBeforeUnloadConfirmPanel(message, frame); 209 bool ok = m_client->runBeforeUnloadConfirmPanel(message, frame);
210 InspectorInstrumentation::didRunJavaScriptDialog(cookie); 210 InspectorInstrumentation::didRunJavaScriptDialog(cookie);
211 return ok; 211 return ok;
212 } 212 }
213 213
214 void Chrome::closeWindowSoon() 214 void Chrome::closeWindowSoon()
215 { 215 {
216 m_client->closeWindowSoon(); 216 m_client->closeWindowSoon();
217 } 217 }
218 218
219 void Chrome::runJavaScriptAlert(Frame* frame, const String& message) 219 void Chrome::runJavaScriptAlert(Frame* frame, const String& message)
220 { 220 {
221 if (!canRunModalIfDuringPageDismissal(m_page, ChromeClient::AlertDialog, mes sage)) 221 if (!canRunModalIfDuringPageDismissal(m_page, ChromeClient::AlertDialog, mes sage))
222 return; 222 return;
223 223
224 // Defer loads in case the client method runs a new event loop that would 224 // Defer loads in case the client method runs a new event loop that would
225 // otherwise cause the load to continue while we're in the middle of executi ng JavaScript. 225 // otherwise cause the load to continue while we're in the middle of executi ng JavaScript.
226 PageGroupLoadDeferrer deferrer(m_page, true); 226 ScopedPageLoadDeferrer deferrer;
227 227
228 ASSERT(frame); 228 ASSERT(frame);
229 notifyPopupOpeningObservers(); 229 notifyPopupOpeningObservers();
230 230
231 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav aScriptDialog(m_page, message); 231 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav aScriptDialog(m_page, message);
232 m_client->runJavaScriptAlert(frame, message); 232 m_client->runJavaScriptAlert(frame, message);
233 InspectorInstrumentation::didRunJavaScriptDialog(cookie); 233 InspectorInstrumentation::didRunJavaScriptDialog(cookie);
234 } 234 }
235 235
236 bool Chrome::runJavaScriptConfirm(Frame* frame, const String& message) 236 bool Chrome::runJavaScriptConfirm(Frame* frame, const String& message)
237 { 237 {
238 if (!canRunModalIfDuringPageDismissal(m_page, ChromeClient::ConfirmDialog, m essage)) 238 if (!canRunModalIfDuringPageDismissal(m_page, ChromeClient::ConfirmDialog, m essage))
239 return false; 239 return false;
240 240
241 // Defer loads in case the client method runs a new event loop that would 241 // Defer loads in case the client method runs a new event loop that would
242 // otherwise cause the load to continue while we're in the middle of executi ng JavaScript. 242 // otherwise cause the load to continue while we're in the middle of executi ng JavaScript.
243 PageGroupLoadDeferrer deferrer(m_page, true); 243 ScopedPageLoadDeferrer deferrer;
244 244
245 ASSERT(frame); 245 ASSERT(frame);
246 notifyPopupOpeningObservers(); 246 notifyPopupOpeningObservers();
247 247
248 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav aScriptDialog(m_page, message); 248 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav aScriptDialog(m_page, message);
249 bool ok = m_client->runJavaScriptConfirm(frame, message); 249 bool ok = m_client->runJavaScriptConfirm(frame, message);
250 InspectorInstrumentation::didRunJavaScriptDialog(cookie); 250 InspectorInstrumentation::didRunJavaScriptDialog(cookie);
251 return ok; 251 return ok;
252 } 252 }
253 253
254 bool Chrome::runJavaScriptPrompt(Frame* frame, const String& prompt, const Strin g& defaultValue, String& result) 254 bool Chrome::runJavaScriptPrompt(Frame* frame, const String& prompt, const Strin g& defaultValue, String& result)
255 { 255 {
256 if (!canRunModalIfDuringPageDismissal(m_page, ChromeClient::PromptDialog, pr ompt)) 256 if (!canRunModalIfDuringPageDismissal(m_page, ChromeClient::PromptDialog, pr ompt))
257 return false; 257 return false;
258 258
259 // Defer loads in case the client method runs a new event loop that would 259 // Defer loads in case the client method runs a new event loop that would
260 // otherwise cause the load to continue while we're in the middle of executi ng JavaScript. 260 // otherwise cause the load to continue while we're in the middle of executi ng JavaScript.
261 PageGroupLoadDeferrer deferrer(m_page, true); 261 ScopedPageLoadDeferrer deferrer;
262 262
263 ASSERT(frame); 263 ASSERT(frame);
264 notifyPopupOpeningObservers(); 264 notifyPopupOpeningObservers();
265 265
266 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav aScriptDialog(m_page, prompt); 266 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJav aScriptDialog(m_page, prompt);
267 bool ok = m_client->runJavaScriptPrompt(frame, prompt, defaultValue, result) ; 267 bool ok = m_client->runJavaScriptPrompt(frame, prompt, defaultValue, result) ;
268 InspectorInstrumentation::didRunJavaScriptDialog(cookie); 268 InspectorInstrumentation::didRunJavaScriptDialog(cookie);
269 269
270 return ok; 270 return ok;
271 } 271 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 toolTipDirection = LTR; 315 toolTipDirection = LTR;
316 } 316 }
317 } 317 }
318 } 318 }
319 319
320 m_client->setToolTip(toolTip, toolTipDirection); 320 m_client->setToolTip(toolTip, toolTipDirection);
321 } 321 }
322 322
323 void Chrome::print(Frame* frame) 323 void Chrome::print(Frame* frame)
324 { 324 {
325 // FIXME: This should have PageGroupLoadDeferrer, like runModal() or runJava ScriptAlert(), becasue it's no different from those. 325 // Defer loads in case the client method runs a new event loop that would
326 // otherwise cause the load to continue while we're in the middle of executi ng JavaScript.
327 ScopedPageLoadDeferrer deferrer;
328
326 m_client->print(frame); 329 m_client->print(frame);
327 } 330 }
328 331
329 void Chrome::enumerateChosenDirectory(FileChooser* fileChooser) 332 void Chrome::enumerateChosenDirectory(FileChooser* fileChooser)
330 { 333 {
331 m_client->enumerateChosenDirectory(fileChooser); 334 m_client->enumerateChosenDirectory(fileChooser);
332 } 335 }
333 336
334 PassOwnPtr<ColorChooser> Chrome::createColorChooser(ColorChooserClient* client, const Color& initialColor) 337 PassOwnPtr<ColorChooser> Chrome::createColorChooser(ColorChooserClient* client, const Color& initialColor)
335 { 338 {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 400 }
398 401
399 void Chrome::notifyPopupOpeningObservers() const 402 void Chrome::notifyPopupOpeningObservers() const
400 { 403 {
401 const Vector<PopupOpeningObserver*> observers(m_popupOpeningObservers); 404 const Vector<PopupOpeningObserver*> observers(m_popupOpeningObservers);
402 for (size_t i = 0; i < observers.size(); ++i) 405 for (size_t i = 0; i < observers.size(); ++i)
403 observers[i]->willOpenPopup(); 406 observers[i]->willOpenPopup();
404 } 407 }
405 408
406 } // namespace WebCore 409 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/page/EventSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698