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

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: Devlin's comments. 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..46831c5b77f9ed3031e6611dcc2453666b5e9983 100644
--- a/extensions/browser/api/execute_code_function.h
+++ b/extensions/browser/api/execute_code_function.h
@@ -45,6 +45,20 @@ class ExecuteCodeFunction : public AsyncExtensionFunction {
host_id_ = host_id;
}
+ protected:
+ virtual bool LoadFile(const std::string& file);
+
+ // Run in UI thread. Code string contains the code to be executed. Returns
+ // true on success. If true is returned, this does an AddRef.
+ bool Execute(const std::string& code_string);
Devlin 2015/03/25 17:55:15 This shouldn't be protected anymore, right?
Xi Han 2015/03/25 20:49:21 Good catch:)
+
+ // Abstracts the details of DidLoadAndLocalizeFile to this function with the
+ // path of file passed in. It can be called by sub classes who load files as
+ // web URLs.
+ void DidLoadFileForHost(const std::string& file,
+ bool success,
+ const std::string& data);
+
private:
// Called when contents from the file whose path is specified in JSON
// arguments has been loaded.
@@ -61,10 +75,6 @@ class ExecuteCodeFunction : public AsyncExtensionFunction {
// Called when contents from the loaded file have been localized.
void DidLoadAndLocalizeFile(bool success, const std::string& data);
- // Run in UI thread. Code string contains the code to be executed. Returns
- // true on success. If true is returned, this does an AddRef.
- bool Execute(const std::string& code_string);
-
// Contains extension resource built from path of file which is
// specified in JSON arguments.
ExtensionResource resource_;

Powered by Google App Engine
This is Rietveld 408576698