diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 09:47:35 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 09:47:35 +0000 |
commit | 912256b3517241047095dac6946de191029dda27 (patch) | |
tree | 7799ca1544916d7e1f44b06bd0dd43e080b61996 /chrome/renderer/render_view.h | |
parent | 50c4e907cf41e395a5edecd1ae122b9a2b35410d (diff) | |
download | chromium_src-912256b3517241047095dac6946de191029dda27.zip chromium_src-912256b3517241047095dac6946de191029dda27.tar.gz chromium_src-912256b3517241047095dac6946de191029dda27.tar.bz2 |
Try again to land "Implement script API:executeScript"
http://codereview.chromium.org/173556
TBR=mpcomplete@chromium.org
Patch from Jerry Tang <tangjie@google.com>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.h')
-rw-r--r-- | chrome/renderer/render_view.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index b647e65..4b35260 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -22,6 +22,7 @@ #include "build/build_config.h" #include "chrome/common/edit_command.h" #include "chrome/common/navigation_gesture.h" +#include "chrome/common/notification_type.h" #include "chrome/common/renderer_preferences.h" #include "chrome/common/view_types.h" #include "chrome/renderer/automation/dom_automation_controller.h" @@ -610,6 +611,10 @@ class RenderView : public RenderWidget, const MediaPlayerAction& action); void OnNotifyRendererViewType(ViewType::Type view_type); void OnUpdateBrowserWindowId(int window_id); + void OnExecuteCode(int request_id, + const std::string& extension_id, + bool is_js_code, + const std::string& code_string); void OnUpdateBackForwardListCount(int back_list_count, int forward_list_count); void OnGetAccessibilityInfo( @@ -909,6 +914,31 @@ class RenderView : public RenderWidget, // Id number of browser window which RenderView is attached to. int browser_window_id_; + // If page is loading, we can't run code, just create CodeExecutionInfo + // objects store pending execution information and delay the execution until + // page is loaded. + struct CodeExecutionInfo : public base::RefCounted<CodeExecutionInfo> { + CodeExecutionInfo(int id_of_request, const std::string& id_of_extension, + bool is_js, const std::string& code) + : request_id(id_of_request), + extension_id(id_of_extension), + code_string(code), + is_js_code(is_js) {} + int request_id; + + // The id of extension who issues the pending executeScript API call. + std::string extension_id; + + // The code which would be executed. + std::string code_string; + + // It's true if |code_string| is JavaScript; otherwise |code_string| is + // CSS text. + bool is_js_code; + }; + + std::queue<scoped_refptr<CodeExecutionInfo> > pending_code_execution_queue_; + // page id for the last navigation sent to the browser. int32 last_top_level_navigation_page_id_; |