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

Side by Side Diff: Source/core/frame/DOMWindow.cpp

Issue 174073007: Remove deprecated window.showModalDialog() (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/frame/DOMWindow.h ('k') | Source/core/frame/Window.idl » ('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, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 Settings* settings = firstFrame->settings(); 305 Settings* settings = firstFrame->settings();
306 return settings && settings->javaScriptCanOpenWindowsAutomatically(); 306 return settings && settings->javaScriptCanOpenWindowsAutomatically();
307 } 307 }
308 308
309 bool DOMWindow::allowPopUp() 309 bool DOMWindow::allowPopUp()
310 { 310 {
311 return m_frame && allowPopUp(m_frame); 311 return m_frame && allowPopUp(m_frame);
312 } 312 }
313 313
314 bool DOMWindow::canShowModalDialog(const Frame* frame)
315 {
316 if (!frame)
317 return false;
318 FrameHost* host = frame->host();
319 if (!host)
320 return false;
321 return host->chrome().canRunModal();
322 }
323
324 bool DOMWindow::canShowModalDialogNow(const Frame* frame)
325 {
326 if (!frame)
327 return false;
328 FrameHost* host = frame->host();
329 if (!host)
330 return false;
331 return host->chrome().canRunModalNow();
332 }
333
334 DOMWindow::DOMWindow(Frame* frame) 314 DOMWindow::DOMWindow(Frame* frame)
335 : FrameDestructionObserver(frame) 315 : FrameDestructionObserver(frame)
336 , m_shouldPrintWhenFinishedLoading(false) 316 , m_shouldPrintWhenFinishedLoading(false)
337 { 317 {
338 ASSERT(frame); 318 ASSERT(frame);
339 ScriptWrappable::init(this); 319 ScriptWrappable::init(this);
340 } 320 }
341 321
342 void DOMWindow::clearDocument() 322 void DOMWindow::clearDocument()
343 { 323 {
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 Referrer(firstFrame->document()->outgoingReferrer(), firstFrame->doc ument()->referrerPolicy()), 1819 Referrer(firstFrame->document()->outgoingReferrer(), firstFrame->doc ument()->referrerPolicy()),
1840 false); 1820 false);
1841 return targetFrame->domWindow(); 1821 return targetFrame->domWindow();
1842 } 1822 }
1843 1823
1844 WindowFeatures windowFeatures(windowFeaturesString); 1824 WindowFeatures windowFeatures(windowFeaturesString);
1845 Frame* result = createWindow(urlString, frameName, windowFeatures, callingWi ndow, firstFrame, m_frame); 1825 Frame* result = createWindow(urlString, frameName, windowFeatures, callingWi ndow, firstFrame, m_frame);
1846 return result ? result->domWindow() : 0; 1826 return result ? result->domWindow() : 0;
1847 } 1827 }
1848 1828
1849 void DOMWindow::showModalDialog(const String& urlString, const String& dialogFea turesString,
1850 DOMWindow* callingWindow, DOMWindow* enteredWindow, PrepareDialogFunction fu nction, void* functionContext)
1851 {
1852 if (!isCurrentlyDisplayedInFrame())
1853 return;
1854 Frame* activeFrame = callingWindow->frame();
1855 if (!activeFrame)
1856 return;
1857 Frame* firstFrame = enteredWindow->frame();
1858 if (!firstFrame)
1859 return;
1860
1861 if (!canShowModalDialogNow(m_frame) || !enteredWindow->allowPopUp())
1862 return;
1863
1864 UseCounter::countDeprecation(this, UseCounter::ShowModalDialog);
1865
1866 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_fr ame->view()));
1867 Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures,
1868 callingWindow, firstFrame, m_frame, function, functionContext);
1869 if (!dialogFrame)
1870 return;
1871 UserGestureIndicatorDisabler disabler;
1872 dialogFrame->host()->chrome().runModal();
1873 }
1874
1875 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) 1829 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index)
1876 { 1830 {
1877 Frame* frame = this->frame(); 1831 Frame* frame = this->frame();
1878 if (!frame) 1832 if (!frame)
1879 return 0; 1833 return 0;
1880 1834
1881 Frame* child = frame->tree().scopedChild(index); 1835 Frame* child = frame->tree().scopedChild(index);
1882 if (child) 1836 if (child)
1883 return child->domWindow(); 1837 return child->domWindow();
1884 1838
1885 return 0; 1839 return 0;
1886 } 1840 }
1887 1841
1888 DOMWindowLifecycleNotifier& DOMWindow::lifecycleNotifier() 1842 DOMWindowLifecycleNotifier& DOMWindow::lifecycleNotifier()
1889 { 1843 {
1890 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>: :lifecycleNotifier()); 1844 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>: :lifecycleNotifier());
1891 } 1845 }
1892 1846
1893 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier() 1847 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier()
1894 { 1848 {
1895 return DOMWindowLifecycleNotifier::create(this); 1849 return DOMWindowLifecycleNotifier::create(this);
1896 } 1850 }
1897 1851
1898 1852
1899 } // namespace WebCore 1853 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/DOMWindow.h ('k') | Source/core/frame/Window.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698