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

Unified Diff: extensions/browser/api/guest_view/web_view/web_view_internal_api.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: nits 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/guest_view/web_view/web_view_internal_api.h
diff --git a/extensions/browser/api/guest_view/web_view/web_view_internal_api.h b/extensions/browser/api/guest_view/web_view/web_view_internal_api.h
index 37483df9e0a1c09c9b74057999f9cb005b590faa..cd23be2b80efd1365739b457e5f717dcae671d1b 100644
--- a/extensions/browser/api/guest_view/web_view/web_view_internal_api.h
+++ b/extensions/browser/api/guest_view/web_view/web_view_internal_api.h
@@ -54,6 +54,11 @@ class WebViewInternalExecuteCodeFunction
: public extensions::ExecuteCodeFunction {
public:
WebViewInternalExecuteCodeFunction();
+ // 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&)>;
protected:
~WebViewInternalExecuteCodeFunction() override;
@@ -66,8 +71,15 @@ class WebViewInternalExecuteCodeFunction
extensions::ScriptExecutor* GetScriptExecutor() final;
bool IsWebView() const override;
const GURL& GetWebViewSrc() const override;
+ bool LoadFile(const std::string& file) override;
private:
+ class WebUIURLFetcher;
+
+ // Loads a file url on WebUI.
+ bool LoadFileForWebUI(const std::string& file_src,
+ const WebUILoadFileCallback& callback);
+
// Contains extension resource built from path of file which is
// specified in JSON arguments.
extensions::ExtensionResource resource_;
@@ -76,6 +88,8 @@ class WebViewInternalExecuteCodeFunction
GURL guest_src_;
+ scoped_ptr<WebUIURLFetcher> url_fetcher_;
+
DISALLOW_COPY_AND_ASSIGN(WebViewInternalExecuteCodeFunction);
};
« no previous file with comments | « extensions/browser/api/execute_code_function.cc ('k') | extensions/browser/api/guest_view/web_view/web_view_internal_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698