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

Side by Side Diff: Source/core/dom/ExecutionContext.h

Issue 799923006: Make canNavigate() OOPI-friendly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2012 Google Inc. All Rights Reserved. 3 * Copyright (C) 2012 Google Inc. All Rights Reserved.
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 11 matching lines...) Expand all
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * 25 *
26 */ 26 */
27 27
28 #ifndef ExecutionContext_h 28 #ifndef ExecutionContext_h
29 #define ExecutionContext_h 29 #define ExecutionContext_h
30 30
31 #include "core/dom/ActiveDOMObject.h" 31 #include "core/dom/ActiveDOMObject.h"
32 #include "core/dom/SandboxFlags.h"
33 #include "core/dom/SecurityContext.h" 32 #include "core/dom/SecurityContext.h"
34 #include "core/fetch/CrossOriginAccessControl.h" 33 #include "core/fetch/CrossOriginAccessControl.h"
35 #include "core/frame/ConsoleTypes.h" 34 #include "core/frame/ConsoleTypes.h"
36 #include "core/frame/DOMTimer.h" 35 #include "core/frame/DOMTimer.h"
37 #include "core/inspector/ConsoleMessage.h" 36 #include "core/inspector/ConsoleMessage.h"
38 #include "platform/LifecycleContext.h" 37 #include "platform/LifecycleContext.h"
39 #include "platform/Supplementable.h" 38 #include "platform/Supplementable.h"
40 #include "platform/heap/Handle.h" 39 #include "platform/heap/Handle.h"
41 #include "platform/weborigin/KURL.h" 40 #include "platform/weborigin/KURL.h"
42 #include "wtf/Functional.h" 41 #include "wtf/Functional.h"
(...skipping 18 matching lines...) Expand all
61 virtual void trace(Visitor*) override; 60 virtual void trace(Visitor*) override;
62 61
63 virtual bool isDocument() const { return false; } 62 virtual bool isDocument() const { return false; }
64 virtual bool isWorkerGlobalScope() const { return false; } 63 virtual bool isWorkerGlobalScope() const { return false; }
65 virtual bool isDedicatedWorkerGlobalScope() const { return false; } 64 virtual bool isDedicatedWorkerGlobalScope() const { return false; }
66 virtual bool isSharedWorkerGlobalScope() const { return false; } 65 virtual bool isSharedWorkerGlobalScope() const { return false; }
67 virtual bool isServiceWorkerGlobalScope() const { return false; } 66 virtual bool isServiceWorkerGlobalScope() const { return false; }
68 virtual bool isJSExecutionForbidden() const { return false; } 67 virtual bool isJSExecutionForbidden() const { return false; }
69 SecurityOrigin* securityOrigin(); 68 SecurityOrigin* securityOrigin();
70 ContentSecurityPolicy* contentSecurityPolicy(); 69 ContentSecurityPolicy* contentSecurityPolicy();
71 virtual void didUpdateSecurityOrigin() = 0;
72 const KURL& url() const; 70 const KURL& url() const;
73 KURL completeURL(const String& url) const; 71 KURL completeURL(const String& url) const;
74 virtual void disableEval(const String& errorMessage) = 0; 72 virtual void disableEval(const String& errorMessage) = 0;
75 virtual LocalDOMWindow* executingWindow() { return 0; } 73 virtual LocalDOMWindow* executingWindow() { return 0; }
76 virtual String userAgent(const KURL&) const = 0; 74 virtual String userAgent(const KURL&) const = 0;
77 virtual void postTask(PassOwnPtr<ExecutionContextTask>) = 0; // Executes the task on context's thread asynchronously. 75 virtual void postTask(PassOwnPtr<ExecutionContextTask>) = 0; // Executes the task on context's thread asynchronously.
78 virtual double timerAlignmentInterval() const = 0; 76 virtual double timerAlignmentInterval() const = 0;
79 77
80 virtual void reportBlockedScriptExecutionToInspector(const String& directive Text) = 0; 78 virtual void reportBlockedScriptExecutionToInspector(const String& directive Text) = 0;
81 79
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 #endif 115 #endif
118 116
119 // Gets the next id in a circular sequence from 1 to 2^31-1. 117 // Gets the next id in a circular sequence from 1 to 2^31-1.
120 int circularSequentialID(); 118 int circularSequentialID();
121 119
122 void didChangeTimerAlignmentInterval(); 120 void didChangeTimerAlignmentInterval();
123 121
124 int timerNestingLevel() { return m_timerNestingLevel; } 122 int timerNestingLevel() { return m_timerNestingLevel; }
125 void setTimerNestingLevel(int level) { m_timerNestingLevel = level; } 123 void setTimerNestingLevel(int level) { m_timerNestingLevel = level; }
126 124
127 SandboxFlags sandboxFlags() const { return m_sandboxFlags; }
128 bool isSandboxed(SandboxFlags mask) const { return m_sandboxFlags & mask; }
129 void enforceSandboxFlags(SandboxFlags mask);
130
131 PassOwnPtr<LifecycleNotifier<ExecutionContext> > createLifecycleNotifier(); 125 PassOwnPtr<LifecycleNotifier<ExecutionContext> > createLifecycleNotifier();
132 126
133 virtual EventTarget* errorEventTarget() = 0; 127 virtual EventTarget* errorEventTarget() = 0;
134 virtual EventQueue* eventQueue() const = 0; 128 virtual EventQueue* eventQueue() const = 0;
135 129
136 void allowWindowFocus(); 130 void allowWindowFocus();
137 void consumeWindowFocus(); 131 void consumeWindowFocus();
138 bool isWindowFocusAllowed() const; 132 bool isWindowFocusAllowed() const;
139 133
140 protected: 134 protected:
(...skipping 13 matching lines...) Expand all
154 #if !ENABLE(OILPAN) 148 #if !ENABLE(OILPAN)
155 virtual void refExecutionContext() = 0; 149 virtual void refExecutionContext() = 0;
156 virtual void derefExecutionContext() = 0; 150 virtual void derefExecutionContext() = 0;
157 #endif 151 #endif
158 // LifecycleContext implementation. 152 // LifecycleContext implementation.
159 153
160 // Implementation details for DOMTimer. No other classes should call these f unctions. 154 // Implementation details for DOMTimer. No other classes should call these f unctions.
161 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS hot); 155 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS hot);
162 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins tance destructed. 156 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins tance destructed.
163 157
164 SandboxFlags m_sandboxFlags;
165
166 int m_circularSequentialID; 158 int m_circularSequentialID;
167 typedef WillBeHeapHashMap<int, OwnPtrWillBeMember<DOMTimer> > TimeoutMap; 159 typedef WillBeHeapHashMap<int, OwnPtrWillBeMember<DOMTimer> > TimeoutMap;
168 TimeoutMap m_timeouts; 160 TimeoutMap m_timeouts;
169 int m_timerNestingLevel; 161 int m_timerNestingLevel;
170 162
171 bool m_inDispatchErrorEvent; 163 bool m_inDispatchErrorEvent;
172 class PendingException; 164 class PendingException;
173 OwnPtrWillBeMember<WillBeHeapVector<OwnPtrWillBeMember<PendingException> > > m_pendingExceptions; 165 OwnPtrWillBeMember<WillBeHeapVector<OwnPtrWillBeMember<PendingException> > > m_pendingExceptions;
174 166
175 bool m_activeDOMObjectsAreSuspended; 167 bool m_activeDOMObjectsAreSuspended;
176 bool m_activeDOMObjectsAreStopped; 168 bool m_activeDOMObjectsAreStopped;
177 169
178 OwnPtrWillBeMember<PublicURLManager> m_publicURLManager; 170 OwnPtrWillBeMember<PublicURLManager> m_publicURLManager;
179 171
180 // The location of this member is important; to make sure contextDestroyed() notification on 172 // The location of this member is important; to make sure contextDestroyed() notification on
181 // ExecutionContext's members (notably m_timeouts) is called before they are destructed, 173 // ExecutionContext's members (notably m_timeouts) is called before they are destructed,
182 // m_lifecycleNotifer should be placed *after* such members. 174 // m_lifecycleNotifer should be placed *after* such members.
183 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; 175 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier;
184 176
185 // Counter that keeps track of how many window focus calls are allowed for 177 // Counter that keeps track of how many window focus calls are allowed for
186 // this ExecutionContext. Callers are expected to call |allowWindowFocus()| 178 // this ExecutionContext. Callers are expected to call |allowWindowFocus()|
187 // and |consumeWindowFocus()| in order to increment and decrement the 179 // and |consumeWindowFocus()| in order to increment and decrement the
188 // counter. 180 // counter.
189 int m_windowFocusTokens; 181 int m_windowFocusTokens;
190 }; 182 };
191 183
192 } // namespace blink 184 } // namespace blink
193 185
194 #endif // ExecutionContext_h 186 #endif // ExecutionContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698