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

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

Issue 879423003: Move Location to DOMWindow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 return frame() ? frame()->page() : nullptr; 604 return frame() ? frame()->page() : nullptr;
605 } 605 }
606 606
607 void LocalDOMWindow::willDetachFrameHost() 607 void LocalDOMWindow::willDetachFrameHost()
608 { 608 {
609 frame()->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); 609 frame()->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this);
610 frame()->host()->consoleMessageStorage().frameWindowDiscarded(this); 610 frame()->host()->consoleMessageStorage().frameWindowDiscarded(this);
611 LocalDOMWindow::notifyContextDestroyed(); 611 LocalDOMWindow::notifyContextDestroyed();
612 } 612 }
613 613
614 void LocalDOMWindow::willDestroyDocumentInFrame()
615 {
616 for (const auto& domWindowProperty : m_properties)
617 domWindowProperty->willDestroyGlobalObjectInFrame();
618 }
619
620 void LocalDOMWindow::willDetachDocumentFromFrame()
621 {
622 for (const auto& domWindowProperty : m_properties)
623 domWindowProperty->willDetachGlobalObjectFromFrame();
624 }
625
626 void LocalDOMWindow::registerProperty(DOMWindowProperty* property)
627 {
628 m_properties.add(property);
629 }
630
631 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property)
632 {
633 m_properties.remove(property);
634 }
635
636 void LocalDOMWindow::reset() 614 void LocalDOMWindow::reset()
637 { 615 {
638 willDestroyDocumentInFrame(); 616 DOMWindow::reset();
639 m_properties.clear();
640 617
641 m_screen = nullptr; 618 m_screen = nullptr;
642 m_history = nullptr; 619 m_history = nullptr;
643 m_locationbar = nullptr; 620 m_locationbar = nullptr;
644 m_menubar = nullptr; 621 m_menubar = nullptr;
645 m_personalbar = nullptr; 622 m_personalbar = nullptr;
646 m_scrollbars = nullptr; 623 m_scrollbars = nullptr;
647 m_statusbar = nullptr; 624 m_statusbar = nullptr;
648 m_toolbar = nullptr; 625 m_toolbar = nullptr;
649 m_console = nullptr; 626 m_console = nullptr;
650 m_navigator = nullptr; 627 m_navigator = nullptr;
651 m_performance = nullptr; 628 m_performance = nullptr;
652 m_location = nullptr;
653 m_media = nullptr; 629 m_media = nullptr;
654 m_applicationCache = nullptr; 630 m_applicationCache = nullptr;
655 #if ENABLE(ASSERT) 631 #if ENABLE(ASSERT)
656 m_hasBeenReset = true; 632 m_hasBeenReset = true;
657 #endif 633 #endif
658 634
659 LocalDOMWindow::notifyContextDestroyed(); 635 LocalDOMWindow::notifyContextDestroyed();
660 } 636 }
661 637
662 void LocalDOMWindow::sendOrientationChangeEvent() 638 void LocalDOMWindow::sendOrientationChangeEvent()
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 return m_navigator.get(); 758 return m_navigator.get();
783 } 759 }
784 760
785 Performance* LocalDOMWindow::performance() const 761 Performance* LocalDOMWindow::performance() const
786 { 762 {
787 if (!m_performance) 763 if (!m_performance)
788 m_performance = Performance::create(frame()); 764 m_performance = Performance::create(frame());
789 return m_performance.get(); 765 return m_performance.get();
790 } 766 }
791 767
792 Location* LocalDOMWindow::location() const
793 {
794 if (!m_location)
795 m_location = Location::create(frame());
796 return m_location.get();
797 }
798
799 void LocalDOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, cons t MessagePortArray* ports, const String& targetOrigin, LocalDOMWindow* source, E xceptionState& exceptionState) 768 void LocalDOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, cons t MessagePortArray* ports, const String& targetOrigin, LocalDOMWindow* source, E xceptionState& exceptionState)
800 { 769 {
801 if (!isCurrentlyDisplayedInFrame()) 770 if (!isCurrentlyDisplayedInFrame())
802 return; 771 return;
803 772
804 Document* sourceDocument = source->document(); 773 Document* sourceDocument = source->document();
805 774
806 // Compute the target origin. We need to do this synchronously in order 775 // Compute the target origin. We need to do this synchronously in order
807 // to generate the SyntaxError exception correctly. 776 // to generate the SyntaxError exception correctly.
808 RefPtr<SecurityOrigin> target; 777 RefPtr<SecurityOrigin> target;
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 visitor->trace(m_screen); 1796 visitor->trace(m_screen);
1828 visitor->trace(m_history); 1797 visitor->trace(m_history);
1829 visitor->trace(m_locationbar); 1798 visitor->trace(m_locationbar);
1830 visitor->trace(m_menubar); 1799 visitor->trace(m_menubar);
1831 visitor->trace(m_personalbar); 1800 visitor->trace(m_personalbar);
1832 visitor->trace(m_scrollbars); 1801 visitor->trace(m_scrollbars);
1833 visitor->trace(m_statusbar); 1802 visitor->trace(m_statusbar);
1834 visitor->trace(m_toolbar); 1803 visitor->trace(m_toolbar);
1835 visitor->trace(m_console); 1804 visitor->trace(m_console);
1836 visitor->trace(m_navigator); 1805 visitor->trace(m_navigator);
1837 visitor->trace(m_location);
1838 visitor->trace(m_media); 1806 visitor->trace(m_media);
1839 visitor->trace(m_applicationCache); 1807 visitor->trace(m_applicationCache);
1840 visitor->trace(m_performance); 1808 visitor->trace(m_performance);
1841 visitor->trace(m_css); 1809 visitor->trace(m_css);
1842 visitor->trace(m_eventQueue); 1810 visitor->trace(m_eventQueue);
1843 visitor->trace(m_postMessageTimers); 1811 visitor->trace(m_postMessageTimers);
1844 HeapSupplementable<LocalDOMWindow>::trace(visitor); 1812 HeapSupplementable<LocalDOMWindow>::trace(visitor);
1845 #endif 1813 #endif
1846 DOMWindow::trace(visitor); 1814 DOMWindow::trace(visitor);
1847 LifecycleContext<LocalDOMWindow>::trace(visitor); 1815 LifecycleContext<LocalDOMWindow>::trace(visitor);
1848 } 1816 }
1849 1817
1850 LocalFrame* LocalDOMWindow::frame() const 1818 LocalFrame* LocalDOMWindow::frame() const
1851 { 1819 {
1852 return m_frameObserver->frame(); 1820 return m_frameObserver->frame();
1853 } 1821 }
1854 1822
1855 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 1823 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
1856 { 1824 {
1857 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. 1825 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8].
1858 return v8::Handle<v8::Object>(); 1826 return v8::Handle<v8::Object>();
1859 } 1827 }
1860 1828
1861 } // namespace blink 1829 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698