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/core/dom/ExecutionContext.h

Issue 777483004: Bind Window focus ability to the ExecutionContext instead of the process. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sw_client_focus
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
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 SandboxFlags sandboxFlags() const { return m_sandboxFlags; } 127 SandboxFlags sandboxFlags() const { return m_sandboxFlags; }
128 bool isSandboxed(SandboxFlags mask) const { return m_sandboxFlags & mask; } 128 bool isSandboxed(SandboxFlags mask) const { return m_sandboxFlags & mask; }
129 void enforceSandboxFlags(SandboxFlags mask); 129 void enforceSandboxFlags(SandboxFlags mask);
130 130
131 PassOwnPtr<LifecycleNotifier<ExecutionContext> > createLifecycleNotifier(); 131 PassOwnPtr<LifecycleNotifier<ExecutionContext> > createLifecycleNotifier();
132 132
133 virtual EventTarget* errorEventTarget() = 0; 133 virtual EventTarget* errorEventTarget() = 0;
134 virtual EventQueue* eventQueue() const = 0; 134 virtual EventQueue* eventQueue() const = 0;
135 135
136 void allowWindowFocus();
137 void consumeWindowFocus();
138 bool isWindowFocusAllowed() const;
139
136 protected: 140 protected:
137 ExecutionContext(); 141 ExecutionContext();
138 virtual ~ExecutionContext(); 142 virtual ~ExecutionContext();
139 143
140 virtual const KURL& virtualURL() const = 0; 144 virtual const KURL& virtualURL() const = 0;
141 virtual KURL virtualCompleteURL(const String&) const = 0; 145 virtual KURL virtualCompleteURL(const String&) const = 0;
142 146
143 ContextLifecycleNotifier& lifecycleNotifier(); 147 ContextLifecycleNotifier& lifecycleNotifier();
144 148
145 private: 149 private:
(...skipping 24 matching lines...) Expand all
170 174
171 bool m_activeDOMObjectsAreSuspended; 175 bool m_activeDOMObjectsAreSuspended;
172 bool m_activeDOMObjectsAreStopped; 176 bool m_activeDOMObjectsAreStopped;
173 177
174 OwnPtrWillBeMember<PublicURLManager> m_publicURLManager; 178 OwnPtrWillBeMember<PublicURLManager> m_publicURLManager;
175 179
176 // The location of this member is important; to make sure contextDestroyed() notification on 180 // The location of this member is important; to make sure contextDestroyed() notification on
177 // ExecutionContext's members (notably m_timeouts) is called before they are destructed, 181 // ExecutionContext's members (notably m_timeouts) is called before they are destructed,
178 // m_lifecycleNotifer should be placed *after* such members. 182 // m_lifecycleNotifer should be placed *after* such members.
179 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; 183 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier;
184
185 // Counter that keeps track of how many window focus calls are allowed for
186 // this ExecutionContext. Callers are expected to call |allowWindowFocus()|
187 // and |consumeWindowFocus()| in order to increment and decrement the
188 // counter.
189 int m_windowFocusTokens;
180 }; 190 };
181 191
182 } // namespace blink 192 } // namespace blink
183 193
184 #endif // ExecutionContext_h 194 #endif // ExecutionContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698