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

Side by Side Diff: Source/web/WebLocalFrameImpl.cpp

Issue 338993003: Cleanup various WebView/WebFrame APIs to properly handle remote frames. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Refine comment Created 6 years, 6 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/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 if (WebFrame::opener() && !opener && m_client) 649 if (WebFrame::opener() && !opener && m_client)
650 m_client->didDisownOpener(this); 650 m_client->didDisownOpener(this);
651 651
652 WebFrame::setOpener(opener); 652 WebFrame::setOpener(opener);
653 653
654 ASSERT(m_frame); 654 ASSERT(m_frame);
655 if (m_frame && m_frame->document()) 655 if (m_frame && m_frame->document())
656 m_frame->document()->initSecurityContext(); 656 m_frame->document()->initSecurityContext();
657 } 657 }
658 658
659 // FIXME: These methods should move into WebFrame once FrameTree is no longer
660 // dependent on LocalFrame.
661 void WebLocalFrameImpl::appendChild(WebFrame* child)
662 {
663 WebFrame::appendChild(child);
664 frame()->tree().invalidateScopedChildCount();
665 }
666
667 void WebLocalFrameImpl::removeChild(WebFrame* child)
668 {
669 WebFrame::removeChild(child);
670 frame()->tree().invalidateScopedChildCount();
671 }
672
673 WebFrame* WebLocalFrameImpl::traversePrevious(bool wrap) const
674 {
675 if (!frame())
676 return 0;
677 // FIXME: This should move to WebFrame and become local/remote agnostic.
678 Frame* prevFrame = frame()->tree().traversePreviousWithWrap(wrap);
679 if (!prevFrame || !prevFrame->isLocalFrame())
680 return 0;
681 return fromFrame(toLocalFrame(prevFrame));
682 }
683
684 WebFrame* WebLocalFrameImpl::traverseNext(bool wrap) const
685 {
686 // FIXME: This should move to WebFrame and become local/remote agnostic.
687 if (!frame())
688 return 0;
689 // FIXME: This should move to WebFrame and become local/remote agnostic.
690 Frame* nextFrame = frame()->tree().traverseNextWithWrap(wrap);
691 if (!nextFrame || !nextFrame->isLocalFrame())
692 return 0;
693 return fromFrame(toLocalFrame(nextFrame));
694 }
695
696 WebFrame* WebLocalFrameImpl::findChildByName(const WebString& name) const
697 {
698 // FIXME: This should move to WebFrame and become local/remote agnostic.
699 if (!frame())
700 return 0;
701 // FIXME: This should move to WebFrame and become local/remote agnostic.
702 Frame* child = frame()->tree().child(name);
703 if (!child || !child->isLocalFrame())
704 return 0;
705 return fromFrame(toLocalFrame(child));
706 }
707
708 WebDocument WebLocalFrameImpl::document() const 659 WebDocument WebLocalFrameImpl::document() const
709 { 660 {
710 if (!frame() || !frame()->document()) 661 if (!frame() || !frame()->document())
711 return WebDocument(); 662 return WebDocument();
712 return WebDocument(frame()->document()); 663 return WebDocument(frame()->document());
713 } 664 }
714 665
715 WebPerformance WebLocalFrameImpl::performance() const 666 WebPerformance WebLocalFrameImpl::performance() const
716 { 667 {
717 if (!frame()) 668 if (!frame())
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 frame()->view()->setInputEventsTransformForEmulation(m_inputEventsOffsetForE mulation, m_inputEventsScaleFactorForEmulation); 1670 frame()->view()->setInputEventsTransformForEmulation(m_inputEventsOffsetForE mulation, m_inputEventsScaleFactorForEmulation);
1720 1671
1721 if (isMainFrame) 1672 if (isMainFrame)
1722 webView->suppressInvalidations(false); 1673 webView->suppressInvalidations(false);
1723 } 1674 }
1724 1675
1725 WebLocalFrameImpl* WebLocalFrameImpl::fromFrame(LocalFrame* frame) 1676 WebLocalFrameImpl* WebLocalFrameImpl::fromFrame(LocalFrame* frame)
1726 { 1677 {
1727 if (!frame) 1678 if (!frame)
1728 return 0; 1679 return 0;
1729 FrameLoaderClient* client = frame->loader().client(); 1680 return fromFrame(*frame);
1681 }
1682
1683 WebLocalFrameImpl* WebLocalFrameImpl::fromFrame(LocalFrame& frame)
1684 {
1685 FrameLoaderClient* client = frame.loader().client();
1730 if (!client || !client->isFrameLoaderClientImpl()) 1686 if (!client || !client->isFrameLoaderClientImpl())
1731 return 0; 1687 return 0;
1732 return toFrameLoaderClientImpl(client)->webFrame(); 1688 return toFrameLoaderClientImpl(client)->webFrame();
1733 } 1689 }
1734 1690
1735 WebLocalFrameImpl* WebLocalFrameImpl::fromFrameOwnerElement(Element* element) 1691 WebLocalFrameImpl* WebLocalFrameImpl::fromFrameOwnerElement(Element* element)
1736 { 1692 {
1737 // FIXME: Why do we check specifically for <iframe> and <frame> here? Why ca n't we get the WebLocalFrameImpl from an <object> element, for example. 1693 // FIXME: Why do we check specifically for <iframe> and <frame> here? Why ca n't we get the WebLocalFrameImpl from an <object> element, for example.
1738 if (!isHTMLFrameElementBase(element)) 1694 if (!isHTMLFrameElementBase(element))
1739 return 0; 1695 return 0;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 { 1906 {
1951 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host , owner); 1907 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host , owner);
1952 setWebCoreFrame(frame); 1908 setWebCoreFrame(frame);
1953 frame->tree().setName(name, fallbackName); 1909 frame->tree().setName(name, fallbackName);
1954 // May dispatch JS events; frame may be detached after this. 1910 // May dispatch JS events; frame may be detached after this.
1955 frame->init(); 1911 frame->init();
1956 return frame; 1912 return frame;
1957 } 1913 }
1958 1914
1959 } // namespace blink 1915 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698