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

Side by Side Diff: Source/core/frame/DOMWindow.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/frame/DOMWindow.h" 6 #include "core/frame/DOMWindow.h"
7 7
8 #include "core/dom/SecurityContext.h" 8 #include "core/dom/SecurityContext.h"
9 #include "core/frame/DOMWindowProperty.h"
9 #include "core/frame/Frame.h" 10 #include "core/frame/Frame.h"
10 #include "core/frame/FrameClient.h" 11 #include "core/frame/FrameClient.h"
12 #include "core/frame/Location.h"
11 #include "platform/weborigin/KURL.h" 13 #include "platform/weborigin/KURL.h"
12 #include "platform/weborigin/SecurityOrigin.h" 14 #include "platform/weborigin/SecurityOrigin.h"
13 15
14 namespace blink { 16 namespace blink {
15 17
18 DOMWindow::~DOMWindow()
19 {
20 }
21
22 Location* DOMWindow::location() const
23 {
24 if (!m_location)
25 m_location = Location::create(frame());
26 return m_location.get();
27 }
28
16 bool DOMWindow::closed() const 29 bool DOMWindow::closed() const
17 { 30 {
18 return !frame() || !frame()->host(); 31 return !frame() || !frame()->host();
19 } 32 }
20 33
21 unsigned DOMWindow::length() const 34 unsigned DOMWindow::length() const
22 { 35 {
23 return frame() ? frame()->tree().scopedChildCount() : 0; 36 return frame() ? frame()->tree().scopedChildCount() : 0;
24 } 37 }
25 38
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return false; 98 return false;
86 99
87 // FIXME: The name canAccess seems to be a roundabout way to ask "can ex ecute script". 100 // FIXME: The name canAccess seems to be a roundabout way to ask "can ex ecute script".
88 // Can we name the SecurityOrigin function better to make this more clea r? 101 // Can we name the SecurityOrigin function better to make this more clea r?
89 if (callingWindow.frame()->securityContext()->securityOrigin()->canAcces s(frame()->securityContext()->securityOrigin())) 102 if (callingWindow.frame()->securityContext()->securityOrigin()->canAcces s(frame()->securityContext()->securityOrigin()))
90 return false; 103 return false;
91 } 104 }
92 return true; 105 return true;
93 } 106 }
94 107
108 void DOMWindow::reset()
109 {
110 willDestroyDocumentInFrame();
111 m_properties.clear();
112 m_location = nullptr;
113 }
114
115 void DOMWindow::registerProperty(DOMWindowProperty* property)
116 {
117 m_properties.add(property);
118 }
119
120 void DOMWindow::unregisterProperty(DOMWindowProperty* property)
121 {
122 m_properties.remove(property);
123 }
124
125 void DOMWindow::willDestroyDocumentInFrame()
126 {
127 for (const auto& domWindowProperty : m_properties)
128 domWindowProperty->willDestroyGlobalObjectInFrame();
129 }
130
131 void DOMWindow::willDetachDocumentFromFrame()
132 {
133 for (const auto& domWindowProperty : m_properties)
134 domWindowProperty->willDetachGlobalObjectFromFrame();
135 }
136
95 } // namespace blink 137 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698