Add support for addUserScript to chromium port.


git-svn-id: svn://svn.chromium.org/blink/trunk@54152 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 78c25b47
2010-01-27 Matt Perry <mpcomplete@chromium.org>
Reviewed by Eric Seidel.
Add support for addUserScript to chromium port.
* bindings/v8/ScriptController.cpp:
(WebCore::ScriptController::evaluateInWorld):
* bindings/v8/ScriptController.h:
2010-02-01 Eric Carlson <eric.carlson@apple.com> 2010-02-01 Eric Carlson <eric.carlson@apple.com>
Reviewed by Dan Bernstein. Reviewed by Dan Bernstein.
......
...@@ -353,6 +353,15 @@ void ScriptController::getAllWorlds(Vector<DOMWrapperWorld*>& worlds) ...@@ -353,6 +353,15 @@ void ScriptController::getAllWorlds(Vector<DOMWrapperWorld*>& worlds)
worlds.append(mainThreadNormalWorld()); worlds.append(mainThreadNormalWorld());
} }
void ScriptController::evaluateInWorld(const ScriptSourceCode& source,
DOMWrapperWorld* world)
{
Vector<ScriptSourceCode> sources;
sources.append(source);
// FIXME: Get an ID from the world param.
evaluateInIsolatedWorld(0, sources);
}
static NPObject* createNoScriptObject() static NPObject* createNoScriptObject()
{ {
notImplemented(); notImplemented();
......
...@@ -165,7 +165,7 @@ public: ...@@ -165,7 +165,7 @@ public:
#endif #endif
// Dummy method to avoid a bunch of ifdef's in WebCore. // Dummy method to avoid a bunch of ifdef's in WebCore.
void evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*) { } void evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*);
static void getAllWorlds(Vector<DOMWrapperWorld*>& worlds); static void getAllWorlds(Vector<DOMWrapperWorld*>& worlds);
private: private:
......
2010-01-27 Matt Perry <mpcomplete@chromium.org>
Reviewed by Eric Seidel.
Add support for addUserScript to chromium port.
* public/WebView.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::addUserScript):
(WebKit::WebViewImpl::removeAllUserContent):
* src/WebViewImpl.h:
2010-01-29 Philippe Normand <pnormand@igalia.com> 2010-01-29 Philippe Normand <pnormand@igalia.com>
Reviewed by Eric Carlson. Reviewed by Eric Carlson.
......
...@@ -262,6 +262,10 @@ public: ...@@ -262,6 +262,10 @@ public:
unsigned inactiveBackgroundColor, unsigned inactiveBackgroundColor,
unsigned inactiveForegroundColor) = 0; unsigned inactiveForegroundColor) = 0;
// User scripts --------------------------------------------------------
virtual void addUserScript(const WebString& sourceCode,
bool runAtStart) = 0;
virtual void removeAllUserContent() = 0;
// Modal dialog support ------------------------------------------------ // Modal dialog support ------------------------------------------------
......
...@@ -1694,6 +1694,20 @@ void WebViewImpl::setSelectionColors(unsigned activeBackgroundColor, ...@@ -1694,6 +1694,20 @@ void WebViewImpl::setSelectionColors(unsigned activeBackgroundColor,
#endif #endif
} }
void WebViewImpl::addUserScript(const WebString& sourceCode, bool runAtStart)
{
PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName);
RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create());
pageGroup->addUserScriptToWorld(world.get(), sourceCode, WebURL(), 0, 0,
runAtStart ? InjectAtDocumentStart : InjectAtDocumentEnd);
}
void WebViewImpl::removeAllUserContent()
{
PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName);
pageGroup->removeAllUserContent();
}
void WebViewImpl::didCommitLoad(bool* isNewNavigation) void WebViewImpl::didCommitLoad(bool* isNewNavigation)
{ {
if (isNewNavigation) if (isNewNavigation)
......
...@@ -162,6 +162,9 @@ public: ...@@ -162,6 +162,9 @@ public:
unsigned inactiveBackgroundColor, unsigned inactiveBackgroundColor,
unsigned inactiveForegroundColor); unsigned inactiveForegroundColor);
virtual void performCustomContextMenuAction(unsigned action); virtual void performCustomContextMenuAction(unsigned action);
virtual void addUserScript(const WebString& sourceCode,
bool runAtStart);
virtual void removeAllUserContent();
// WebViewImpl // WebViewImpl
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment