summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_thread.h
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-18 01:02:38 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-18 01:02:38 +0000
commit25ec8f6027e4a2b004b226371136517b6b673077 (patch)
tree3948779e2f71b11e8b6e918a794aa26979b5a3ea /chrome/renderer/render_thread.h
parenta558e8d49949e1aa5dd17d38d4c45e4a83f5cc1b (diff)
downloadchromium_src-25ec8f6027e4a2b004b226371136517b6b673077.zip
chromium_src-25ec8f6027e4a2b004b226371136517b6b673077.tar.gz
chromium_src-25ec8f6027e4a2b004b226371136517b6b673077.tar.bz2
Fix regression introduced by
http://src.chromium.org/viewvc/chrome?view=rev&revision=57788 Add a delegate interface so that chromium have more fine-grained control over whether a V8 extension is injected into a script context. This is the chromium-side change of webkit bug https://bugs.webkit.org/show_bug.cgi?id=45721 BUG=37290 TEST=covered by unit tests Review URL: http://codereview.chromium.org/3398001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59889 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_thread.h')
-rw-r--r--chrome/renderer/render_thread.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h
index 76d9428..d7a7594 100644
--- a/chrome/renderer/render_thread.h
+++ b/chrome/renderer/render_thread.h
@@ -6,6 +6,7 @@
#define CHROME_RENDERER_RENDER_THREAD_H_
#pragma once
+#include <map>
#include <string>
#include <vector>
@@ -60,6 +61,10 @@ namespace WebKit {
class WebStorageEventDispatcher;
}
+namespace v8 {
+class Extension;
+}
+
// The RenderThreadBase is the minimal interface that a RenderView/Widget
// expects from a render thread. The interface basically abstracts a way to send
// and receive messages.
@@ -231,6 +236,13 @@ class RenderThread : public RenderThreadBase,
// on the renderer's main thread.
scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy();
+ // This function is called for every registered V8 extension each time a new
+ // script context is created. Returns true if the given V8 extension is
+ // allowed to run on the given URL and extension group.
+ bool AllowScriptExtension(const std::string& v8_extension_name,
+ const GURL& url,
+ int extension_group);
+
private:
virtual void OnControlMessageReceived(const IPC::Message& msg);
@@ -309,6 +321,10 @@ class RenderThread : public RenderThreadBase,
// Schedule a call to IdleHandler with the given initial delay.
void ScheduleIdleHandler(double initial_delay_s);
+ // Registers the given V8 extension with WebKit, and also tracks what pages
+ // it is allowed to run on.
+ void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions);
+
// These objects live solely on the render thread.
scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > task_factory_;
scoped_ptr<VisitedLinkSlave> visited_link_slave_;
@@ -369,6 +385,11 @@ class RenderThread : public RenderThreadBase,
// A lazily initiated thread on which file operations are run.
scoped_ptr<base::Thread> file_thread_;
+ // Map of registered v8 extensions. The key is the extension name. The value
+ // is true if the extension should be restricted to extension-related
+ // contexts.
+ std::map<std::string, bool> v8_extensions_;
+
DISALLOW_COPY_AND_ASSIGN(RenderThread);
};