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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptController.h

Issue 2630693002: Make ScriptController inherit LocalWindowProxyManager
Patch Set: rebase Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/ScriptController.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptController.h b/third_party/WebKit/Source/bindings/core/v8/ScriptController.h
index b161c103497a133bfcffc96929407a75e02c9fe0..cac399914f5e699af516b2c6ece6d775ba661866 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptController.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptController.h
@@ -44,10 +44,15 @@
#include "wtf/text/TextPosition.h"
#include <v8.h>
+namespace WTF {
+class AtomicString;
+} // namespace WTF
+
namespace blink {
class DOMWrapperWorld;
class Element;
+class HTMLDocument;
class KURL;
class ScriptSourceCode;
class SecurityOrigin;
@@ -60,8 +65,13 @@ enum ReasonForCallingCanExecuteScripts {
NotAboutToExecuteScript
};
-class CORE_EXPORT ScriptController final
- : public GarbageCollected<ScriptController> {
+// LocalWindowProxyManager is just a template specialization for the local
+// version of a WindowProxyManager. It contains only the core logic of mapping a
+// DOMWrapperWorld to its corresponding WindowProxy.
+// ScriptController adds functionality for executing scripts and other
+// LocalWindowProxy-specific management logic, such as updating the security
+// origin.
+class CORE_EXPORT ScriptController final : public LocalWindowProxyManager {
WTF_MAKE_NONCOPYABLE(ScriptController);
public:
@@ -70,16 +80,10 @@ class CORE_EXPORT ScriptController final
DoNotExecuteScriptWhenScriptsDisabled
};
- static ScriptController* create(LocalFrame* frame) {
+ static ScriptController* create(LocalFrame& frame) {
return new ScriptController(frame);
}
- DECLARE_TRACE();
-
- // This returns an initialized window proxy. (If the window proxy is not
- // yet initialized, it's implicitly initialized at the first access.)
- LocalWindowProxy* windowProxy(DOMWrapperWorld&);
-
// Evaluate JavaScript in the main world.
void executeScriptInMainWorld(
const String&,
@@ -123,12 +127,15 @@ class CORE_EXPORT ScriptController final
TextPosition eventHandlerPosition() const;
- void clearWindowProxy();
- void updateDocument();
+ void namedItemAdded(HTMLDocument*, const AtomicString&);
+ void namedItemRemoved(HTMLDocument*, const AtomicString&);
+ void clearForClose();
+ void clearForNavigation();
+ void updateDocument();
void updateSecurityOrigin(SecurityOrigin*);
- void clearForClose();
+ void initializeMainWorld();
// Registers a v8 extension to be available on webpages. Will only
// affect v8 contexts initialized after this call. Takes ownership of
@@ -136,22 +143,12 @@ class CORE_EXPORT ScriptController final
static void registerExtensionIfNeeded(v8::Extension*);
static V8Extensions& registeredExtensions();
- v8::Isolate* isolate() const { return m_windowProxyManager->isolate(); }
-
- LocalWindowProxyManager* getWindowProxyManager() const {
- return m_windowProxyManager.get();
- }
-
private:
- explicit ScriptController(LocalFrame*);
-
- LocalFrame* frame() const { return m_windowProxyManager->frame(); }
+ explicit ScriptController(LocalFrame&);
v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&,
AccessControlStatus,
ExecuteScriptPolicy);
-
- Member<LocalWindowProxyManager> m_windowProxyManager;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698