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

Unified Diff: chrome/renderer/render_view.h

Issue 173556: Implement script API:executeScript (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « chrome/common/render_messages_internal.h ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.h
===================================================================
--- chrome/renderer/render_view.h (revision 26435)
+++ chrome/renderer/render_view.h (working copy)
@@ -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 @@
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 @@
// 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_;
« no previous file with comments | « chrome/common/render_messages_internal.h ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698