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

Side by Side Diff: third_party/WebKit/Source/core/frame/Frame.cpp

Issue 2702273004: bindings: Simplifies WindowProxyManager and its relation to Frame. (Closed)
Patch Set: Addressed review comments. Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
9 * rights reserved. 9 * rights reserved.
10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
(...skipping 12 matching lines...) Expand all
23 * Library General Public License for more details. 23 * Library General Public License for more details.
24 * 24 *
25 * You should have received a copy of the GNU Library General Public License 25 * You should have received a copy of the GNU Library General Public License
26 * along with this library; see the file COPYING.LIB. If not, write to 26 * along with this library; see the file COPYING.LIB. If not, write to
27 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 27 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
28 * Boston, MA 02110-1301, USA. 28 * Boston, MA 02110-1301, USA.
29 */ 29 */
30 30
31 #include "core/frame/Frame.h" 31 #include "core/frame/Frame.h"
32 32
33 #include "bindings/core/v8/WindowProxyManager.h"
33 #include "core/dom/DocumentType.h" 34 #include "core/dom/DocumentType.h"
34 #include "core/events/Event.h" 35 #include "core/events/Event.h"
35 #include "core/frame/FrameHost.h" 36 #include "core/frame/FrameHost.h"
36 #include "core/frame/LocalDOMWindow.h" 37 #include "core/frame/LocalDOMWindow.h"
37 #include "core/frame/Settings.h" 38 #include "core/frame/Settings.h"
38 #include "core/frame/UseCounter.h" 39 #include "core/frame/UseCounter.h"
39 #include "core/html/HTMLFrameElementBase.h" 40 #include "core/html/HTMLFrameElementBase.h"
40 #include "core/input/EventHandler.h" 41 #include "core/input/EventHandler.h"
41 #include "core/inspector/InspectorInstrumentation.h" 42 #include "core/inspector/InspectorInstrumentation.h"
42 #include "core/layout/LayoutPart.h" 43 #include "core/layout/LayoutPart.h"
(...skipping 15 matching lines...) Expand all
58 59
59 Frame::~Frame() { 60 Frame::~Frame() {
60 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter); 61 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter);
61 ASSERT(!m_owner); 62 ASSERT(!m_owner);
62 } 63 }
63 64
64 DEFINE_TRACE(Frame) { 65 DEFINE_TRACE(Frame) {
65 visitor->trace(m_treeNode); 66 visitor->trace(m_treeNode);
66 visitor->trace(m_host); 67 visitor->trace(m_host);
67 visitor->trace(m_owner); 68 visitor->trace(m_owner);
69 visitor->trace(m_windowProxyManager);
68 visitor->trace(m_domWindow); 70 visitor->trace(m_domWindow);
69 visitor->trace(m_client); 71 visitor->trace(m_client);
70 } 72 }
71 73
72 void Frame::detach(FrameDetachType type) { 74 void Frame::detach(FrameDetachType type) {
73 ASSERT(m_client); 75 ASSERT(m_client);
74 m_client->setOpener(0); 76 m_client->setOpener(0);
75 disconnectOwnerElement(); 77 disconnectOwnerElement();
76 // After this, we must no longer talk to the client since this clears 78 // After this, we must no longer talk to the client since this clears
77 // its owning reference back to our owning LocalFrame. 79 // its owning reference back to our owning LocalFrame.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return true; 117 return true;
116 118
117 return tree().parent()->isRemoteFrame(); 119 return tree().parent()->isRemoteFrame();
118 } 120 }
119 121
120 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const { 122 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const {
121 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) 123 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner)
122 : nullptr; 124 : nullptr;
123 } 125 }
124 126
127 WindowProxy* Frame::windowProxy(DOMWrapperWorld& world) {
128 return m_windowProxyManager->windowProxy(world);
129 }
130
125 static ChromeClient& emptyChromeClient() { 131 static ChromeClient& emptyChromeClient() {
126 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, (EmptyChromeClient::create())); 132 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, (EmptyChromeClient::create()));
127 return client; 133 return client;
128 } 134 }
129 135
130 ChromeClient& Frame::chromeClient() const { 136 ChromeClient& Frame::chromeClient() const {
131 if (Page* page = this->page()) 137 if (Page* page = this->page())
132 return page->chromeClient(); 138 return page->chromeClient();
133 return emptyChromeClient(); 139 return emptyChromeClient();
134 } 140 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 for (size_t i = 0; i < childFrames.size(); ++i) 403 for (size_t i = 0; i < childFrames.size(); ++i)
398 childFrames[i]->didChangeVisibilityState(); 404 childFrames[i]->didChangeVisibilityState();
399 } 405 }
400 406
401 void Frame::setDocumentHasReceivedUserGesture() { 407 void Frame::setDocumentHasReceivedUserGesture() {
402 m_hasReceivedUserGesture = true; 408 m_hasReceivedUserGesture = true;
403 if (Frame* parent = tree().parent()) 409 if (Frame* parent = tree().parent())
404 parent->setDocumentHasReceivedUserGesture(); 410 parent->setDocumentHasReceivedUserGesture();
405 } 411 }
406 412
407 Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner) 413 Frame::Frame(FrameClient* client,
414 FrameHost* host,
415 FrameOwner* owner,
416 WindowProxyManager* windowProxyManager)
408 : m_treeNode(this), 417 : m_treeNode(this),
409 m_host(host), 418 m_host(host),
410 m_owner(owner), 419 m_owner(owner),
411 m_client(client), 420 m_client(client),
421 m_windowProxyManager(windowProxyManager),
412 m_isLoading(false) { 422 m_isLoading(false) {
413 InstanceCounters::incrementCounter(InstanceCounters::FrameCounter); 423 InstanceCounters::incrementCounter(InstanceCounters::FrameCounter);
414 424
415 ASSERT(page()); 425 ASSERT(page());
416 426
417 if (m_owner) 427 if (m_owner)
418 m_owner->setContentFrame(*this); 428 m_owner->setContentFrame(*this);
419 else 429 else
420 page()->setMainFrame(this); 430 page()->setMainFrame(this);
421 } 431 }
422 432
423 } // namespace blink 433 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698