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

Unified Diff: extensions/browser/api/execute_code_function.h

Issue 1004253002: Enable <webview>.executeScript outside of Apps and Extensions [2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test. Created 5 years, 9 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: extensions/browser/api/execute_code_function.h
diff --git a/extensions/browser/api/execute_code_function.h b/extensions/browser/api/execute_code_function.h
index db0f441c8149baa5391e216057478f1b77181a7b..118ec38c1dc6a0cef4e2bf18156a4290641f5e8d 100644
--- a/extensions/browser/api/execute_code_function.h
+++ b/extensions/browser/api/execute_code_function.h
@@ -17,6 +17,11 @@ namespace extensions {
// chrome.tabs.executeScript.
class ExecuteCodeFunction : public AsyncExtensionFunction {
public:
+ // Called when a file URL request is complete.
+ // Parameters:
+ // - whether the request is success.
+ // - If yes, the content of the file.
+ using WebUILoadFileCallback = base::Callback<void(bool, const std::string&)>;
ExecuteCodeFunction();
protected:
@@ -33,6 +38,8 @@ class ExecuteCodeFunction : public AsyncExtensionFunction {
virtual ScriptExecutor* GetScriptExecutor() = 0;
virtual bool IsWebView() const = 0;
virtual const GURL& GetWebViewSrc() const = 0;
+ virtual bool LoadFileForWebUI(const std::string& file_src,
+ const WebUILoadFileCallback& callback) = 0;
virtual void OnExecuteCodeFinished(const std::string& error,
const GURL& on_url,
const base::ListValue& result);
@@ -50,6 +57,9 @@ class ExecuteCodeFunction : public AsyncExtensionFunction {
// arguments has been loaded.
void DidLoadFile(bool success, const std::string& data);
+ // Called when the file is loaded for WebUI.
+ void DidLoadFileForWebUI(bool success, const std::string& data);
+
// Runs on FILE thread. Loads message bundles for the extension and
// localizes the CSS data. Calls back DidLoadAndLocalizeFile on the UI thread.
void GetFileURLAndLocalizeCSS(ScriptExecutor::ScriptType script_type,

Powered by Google App Engine
This is Rietveld 408576698