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

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

Issue 683013002: Extract a DOMWindow interface from LocalDOMWindow and use it in the idl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: whee Created 6 years, 1 month 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 /* 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 // also send the event to, to mitigate side effects from event handlers 638 // also send the event to, to mitigate side effects from event handlers
639 // potentially interfering with others. 639 // potentially interfering with others.
640 WillBeHeapVector<RefPtrWillBeMember<Frame> > childFrames; 640 WillBeHeapVector<RefPtrWillBeMember<Frame> > childFrames;
641 for (Frame* child = frame()->tree().firstChild(); child; child = child->tree ().nextSibling()) { 641 for (Frame* child = frame()->tree().firstChild(); child; child = child->tree ().nextSibling()) {
642 childFrames.append(child); 642 childFrames.append(child);
643 } 643 }
644 644
645 dispatchEvent(Event::create(EventTypeNames::orientationchange)); 645 dispatchEvent(Event::create(EventTypeNames::orientationchange));
646 646
647 for (size_t i = 0; i < childFrames.size(); ++i) { 647 for (size_t i = 0; i < childFrames.size(); ++i) {
648 if (childFrames[i]->domWindow()) 648 if (!childFrames[i]->isLocalFrame())
649 childFrames[i]->domWindow()->sendOrientationChangeEvent(); 649 continue;
650 toLocalFrame(childFrames[i].get())->localDOMWindow()->sendOrientationCha ngeEvent();
650 } 651 }
651 } 652 }
652 653
653 int LocalDOMWindow::orientation() const 654 int LocalDOMWindow::orientation() const
654 { 655 {
655 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); 656 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled());
656 657
657 if (!frame()) 658 if (!frame())
658 return 0; 659 return 0;
659 660
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 if (frameName == "_top") 1849 if (frameName == "_top")
1849 targetFrame = frame()->tree().top(); 1850 targetFrame = frame()->tree().top();
1850 else if (frameName == "_parent") { 1851 else if (frameName == "_parent") {
1851 if (Frame* parent = frame()->tree().parent()) 1852 if (Frame* parent = frame()->tree().parent())
1852 targetFrame = parent; 1853 targetFrame = parent;
1853 else 1854 else
1854 targetFrame = frame(); 1855 targetFrame = frame();
1855 } 1856 }
1856 // FIXME: Navigating RemoteFrames is not yet supported. 1857 // FIXME: Navigating RemoteFrames is not yet supported.
1857 if (targetFrame && targetFrame->isLocalFrame()) { 1858 if (targetFrame && targetFrame->isLocalFrame()) {
1858 if (!activeDocument->canNavigate(*targetFrame)) 1859 LocalFrame* localTargetFrame = toLocalFrame(targetFrame);
1860 if (!activeDocument->canNavigate(*localTargetFrame))
1859 return nullptr; 1861 return nullptr;
1860 1862
1861 KURL completedURL = firstFrame->document()->completeURL(urlString); 1863 KURL completedURL = firstFrame->document()->completeURL(urlString);
1862 1864
1863 if (targetFrame->domWindow()->isInsecureScriptAccess(*callingWindow, com pletedURL)) 1865 if (localTargetFrame->localDOMWindow()->isInsecureScriptAccess(*callingW indow, completedURL))
1864 return targetFrame->domWindow(); 1866 return localTargetFrame->localDOMWindow();
1865 1867
1866 if (urlString.isEmpty()) 1868 if (urlString.isEmpty())
1867 return targetFrame->domWindow(); 1869 return localTargetFrame->localDOMWindow();
1868 1870
1869 toLocalFrame(targetFrame)->navigationScheduler().scheduleLocationChange( activeDocument, completedURL, false); 1871 localTargetFrame->navigationScheduler().scheduleLocationChange(activeDoc ument, completedURL, false);
1870 return targetFrame->domWindow(); 1872 return localTargetFrame->localDOMWindow();
1871 } 1873 }
1872 1874
1873 WindowFeatures windowFeatures(windowFeaturesString); 1875 WindowFeatures windowFeatures(windowFeaturesString);
1874 LocalFrame* result = createWindow(urlString, frameName, windowFeatures, *cal lingWindow, *firstFrame, *frame()); 1876 LocalFrame* result = createWindow(urlString, frameName, windowFeatures, *cal lingWindow, *firstFrame, *frame());
1875 return result ? result->domWindow() : 0; 1877 return result ? result->localDOMWindow() : 0;
1876 } 1878 }
1877 1879
1878 void LocalDOMWindow::showModalDialog(const String& urlString, const String& dial ogFeaturesString, 1880 void LocalDOMWindow::showModalDialog(const String& urlString, const String& dial ogFeaturesString,
1879 LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, PrepareDialogF unction function, void* functionContext) 1881 LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, PrepareDialogF unction function, void* functionContext)
1880 { 1882 {
1881 if (!isCurrentlyDisplayedInFrame()) 1883 if (!isCurrentlyDisplayedInFrame())
1882 return; 1884 return;
1883 LocalFrame* activeFrame = callingWindow->frame(); 1885 LocalFrame* activeFrame = callingWindow->frame();
1884 if (!activeFrame) 1886 if (!activeFrame)
1885 return; 1887 return;
(...skipping 14 matching lines...) Expand all
1900 UserGestureIndicatorDisabler disabler; 1902 UserGestureIndicatorDisabler disabler;
1901 dialogFrame->host()->chrome().runModal(); 1903 dialogFrame->host()->chrome().runModal();
1902 } 1904 }
1903 1905
1904 LocalDOMWindow* LocalDOMWindow::anonymousIndexedGetter(uint32_t index) 1906 LocalDOMWindow* LocalDOMWindow::anonymousIndexedGetter(uint32_t index)
1905 { 1907 {
1906 if (!frame()) 1908 if (!frame())
1907 return 0; 1909 return 0;
1908 1910
1909 Frame* child = frame()->tree().scopedChild(index); 1911 Frame* child = frame()->tree().scopedChild(index);
1912 // FIXME: Temporary hack to stage the conversions.
1910 if (child) 1913 if (child)
1911 return child->domWindow(); 1914 return static_cast<LocalDOMWindow*>(child->domWindow());
1912 1915
1913 return 0; 1916 return 0;
1914 } 1917 }
1915 1918
1916 DOMWindowLifecycleNotifier& LocalDOMWindow::lifecycleNotifier() 1919 DOMWindowLifecycleNotifier& LocalDOMWindow::lifecycleNotifier()
1917 { 1920 {
1918 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin dow>::lifecycleNotifier()); 1921 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin dow>::lifecycleNotifier());
1919 } 1922 }
1920 1923
1921 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo tifier() 1924 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo tifier()
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 return m_frameObserver->frame(); 1961 return m_frameObserver->frame();
1959 } 1962 }
1960 1963
1961 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 1964 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
1962 { 1965 {
1963 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. 1966 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8].
1964 return v8::Handle<v8::Object>(); 1967 return v8::Handle<v8::Object>();
1965 } 1968 }
1966 1969
1967 } // namespace blink 1970 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698