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

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: Fixed WindowProxyManager::createWindowProxy(ForFrame). Created 3 years, 9 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 14 matching lines...) Expand all
57 58
58 Frame::~Frame() { 59 Frame::~Frame() {
59 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter); 60 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter);
60 ASSERT(!m_owner); 61 ASSERT(!m_owner);
61 } 62 }
62 63
63 DEFINE_TRACE(Frame) { 64 DEFINE_TRACE(Frame) {
64 visitor->trace(m_treeNode); 65 visitor->trace(m_treeNode);
65 visitor->trace(m_host); 66 visitor->trace(m_host);
66 visitor->trace(m_owner); 67 visitor->trace(m_owner);
68 visitor->trace(m_windowProxyManager);
67 visitor->trace(m_domWindow); 69 visitor->trace(m_domWindow);
68 visitor->trace(m_client); 70 visitor->trace(m_client);
69 } 71 }
70 72
71 void Frame::detach(FrameDetachType type) { 73 void Frame::detach(FrameDetachType type) {
72 ASSERT(m_client); 74 ASSERT(m_client);
73 m_client->setOpener(0); 75 m_client->setOpener(0);
74 disconnectOwnerElement(); 76 disconnectOwnerElement();
75 // After this, we must no longer talk to the client since this clears 77 // After this, we must no longer talk to the client since this clears
76 // its owning reference back to our owning LocalFrame. 78 // its owning reference back to our owning LocalFrame.
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 LayoutPartItem Frame::ownerLayoutItem() const { 382 LayoutPartItem Frame::ownerLayoutItem() const {
381 return LayoutPartItem(ownerLayoutObject()); 383 return LayoutPartItem(ownerLayoutObject());
382 } 384 }
383 385
384 Settings* Frame::settings() const { 386 Settings* Frame::settings() const {
385 if (page()) 387 if (page())
386 return &page()->settings(); 388 return &page()->settings();
387 return nullptr; 389 return nullptr;
388 } 390 }
389 391
392 WindowProxy* Frame::windowProxy(DOMWrapperWorld& world) {
393 return m_windowProxyManager->windowProxy(world);
394 }
395
390 void Frame::didChangeVisibilityState() { 396 void Frame::didChangeVisibilityState() {
391 HeapVector<Member<Frame>> childFrames; 397 HeapVector<Member<Frame>> childFrames;
392 for (Frame* child = tree().firstChild(); child; 398 for (Frame* child = tree().firstChild(); child;
393 child = child->tree().nextSibling()) 399 child = child->tree().nextSibling())
394 childFrames.push_back(child); 400 childFrames.push_back(child);
395 for (size_t i = 0; i < childFrames.size(); ++i) 401 for (size_t i = 0; i < childFrames.size(); ++i)
396 childFrames[i]->didChangeVisibilityState(); 402 childFrames[i]->didChangeVisibilityState();
397 } 403 }
398 404
399 void Frame::setDocumentHasReceivedUserGesture() { 405 void Frame::setDocumentHasReceivedUserGesture() {
400 m_hasReceivedUserGesture = true; 406 m_hasReceivedUserGesture = true;
401 if (Frame* parent = tree().parent()) 407 if (Frame* parent = tree().parent())
402 parent->setDocumentHasReceivedUserGesture(); 408 parent->setDocumentHasReceivedUserGesture();
403 } 409 }
404 410
405 bool Frame::isFeatureEnabled(WebFeaturePolicyFeature feature) const { 411 bool Frame::isFeatureEnabled(WebFeaturePolicyFeature feature) const {
406 WebFeaturePolicy* featurePolicy = securityContext()->getFeaturePolicy(); 412 WebFeaturePolicy* featurePolicy = securityContext()->getFeaturePolicy();
407 // The policy should always be initialized before checking it to ensure we 413 // The policy should always be initialized before checking it to ensure we
408 // properly inherit the parent policy. 414 // properly inherit the parent policy.
409 DCHECK(featurePolicy); 415 DCHECK(featurePolicy);
410 416
411 // Otherwise, check policy. 417 // Otherwise, check policy.
412 return featurePolicy->IsFeatureEnabled(feature); 418 return featurePolicy->IsFeatureEnabled(feature);
413 } 419 }
414 420
415 Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner) 421 Frame::Frame(FrameClient* client,
422 FrameHost* host,
423 FrameOwner* owner,
424 WindowProxyManager* windowProxyManager)
416 : m_treeNode(this), 425 : m_treeNode(this),
417 m_host(host), 426 m_host(host),
418 m_owner(owner), 427 m_owner(owner),
419 m_client(client), 428 m_client(client),
429 m_windowProxyManager(windowProxyManager),
420 m_isLoading(false) { 430 m_isLoading(false) {
421 InstanceCounters::incrementCounter(InstanceCounters::FrameCounter); 431 InstanceCounters::incrementCounter(InstanceCounters::FrameCounter);
422 432
423 ASSERT(page()); 433 ASSERT(page());
424 434
425 if (m_owner) 435 if (m_owner)
426 m_owner->setContentFrame(*this); 436 m_owner->setContentFrame(*this);
427 else 437 else
428 page()->setMainFrame(this); 438 page()->setMainFrame(this);
429 } 439 }
430 440
431 } // namespace blink 441 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698