summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authoraa@google.com <aa@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-16 23:57:47 +0000
committeraa@google.com <aa@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-16 23:57:47 +0000
commit1e0f70402b410a9e274e8d23eeab236b43810a00 (patch)
tree43ebd89055f4666ab3104554551a2177413382db /webkit
parentc2dacc9ec41232903ba700c6aef5ef98bfcb8af8 (diff)
downloadchromium_src-1e0f70402b410a9e274e8d23eeab236b43810a00.zip
chromium_src-1e0f70402b410a9e274e8d23eeab236b43810a00.tar.gz
chromium_src-1e0f70402b410a9e274e8d23eeab236b43810a00.tar.bz2
Adds a bit of Greasemonkey support hidden behind the --enable-greasemonkey flag. Implementation follows the pattern of the visited links system.
Things still to be done: - stop using a hardcoded script directory - watch script directory and update shared memory when necessary - move file io to background thread - support for @include patterns -- now, all scripts are applied to all pages Review URL: http://codereview.chromium.org/7254 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3496 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webframe.h6
-rw-r--r--webkit/glue/webframe_impl.cc7
-rw-r--r--webkit/glue/webframe_impl.h2
3 files changed, 15 insertions, 0 deletions
diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h
index 2169549..c8d73af 100644
--- a/webkit/glue/webframe.h
+++ b/webkit/glue/webframe.h
@@ -91,6 +91,12 @@ class WebFrame : public base::RefCounted<WebFrame> {
bool replace,
const GURL& fake_url) = 0;
+ // Executes a string of JavaScript in the web frame. The script_url param is
+ // the URL where the script in question can be found, if any. The renderer may
+ // request this URL to show the developer the source of the error.
+ virtual void ExecuteJavaScript(const std::string& js_code,
+ const std::string& script_url) = 0;
+
// Returns a string representing the state of the previous page load for
// later use when loading as well as the uri and title of the page. The
// previous page is the page that was loaded before DidCommitLoadForFrame was
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc
index 4710e21..ca8997e 100644
--- a/webkit/glue/webframe_impl.cc
+++ b/webkit/glue/webframe_impl.cc
@@ -1595,6 +1595,13 @@ void WebFrameImpl::LoadAlternateHTMLErrorPage(const WebRequest* request,
error_page_url));
}
+void WebFrameImpl::ExecuteJavaScript(const std::string& js_code,
+ const std::string& script_url) {
+ frame_->loader()->executeScript(webkit_glue::StdStringToString(script_url),
+ 1, // base line number (for errors)
+ webkit_glue::StdStringToString(js_code));
+}
+
std::wstring WebFrameImpl::GetName() {
return webkit_glue::StringToStdWString(frame_->tree()->name());
}
diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h
index fd887d5..9a8afdb 100644
--- a/webkit/glue/webframe_impl.h
+++ b/webkit/glue/webframe_impl.h
@@ -94,6 +94,8 @@ class WebFrameImpl : public WebFrame {
const GURL& error_page_url,
bool replace,
const GURL& fake_url);
+ virtual void ExecuteJavaScript(const std::string& js_code,
+ const std::string& script_url);
virtual bool GetPreviousState(GURL* url, std::wstring* title,
std::string* history_state) const;
virtual bool GetCurrentState(GURL* url, std::wstring* title,