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

Side by Side Diff: chrome/browser/extensions/script_executor.cc

Issue 226043005: Fix webview.executeScript API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update InsertCss API. Created 6 years, 8 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/script_executor.h ('k') | chrome/common/extensions/api/webview.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/script_executor.h" 5 #include "chrome/browser/extensions/script_executor.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 ScriptExecutor::ScriptExecutor( 102 ScriptExecutor::ScriptExecutor(
103 content::WebContents* web_contents, 103 content::WebContents* web_contents,
104 ObserverList<TabHelper::ScriptExecutionObserver>* script_observers) 104 ObserverList<TabHelper::ScriptExecutionObserver>* script_observers)
105 : next_request_id_(0), 105 : next_request_id_(0),
106 web_contents_(web_contents), 106 web_contents_(web_contents),
107 script_observers_(script_observers) {} 107 script_observers_(script_observers) {}
108 108
109 ScriptExecutor::~ScriptExecutor() {} 109 ScriptExecutor::~ScriptExecutor() {}
110 110
111 void ScriptExecutor::ExecuteScript( 111 void ScriptExecutor::ExecuteScript(const std::string& extension_id,
112 const std::string& extension_id, 112 ScriptExecutor::ScriptType script_type,
113 ScriptExecutor::ScriptType script_type, 113 const std::string& code,
114 const std::string& code, 114 ScriptExecutor::FrameScope frame_scope,
115 ScriptExecutor::FrameScope frame_scope, 115 UserScript::RunLocation run_at,
116 UserScript::RunLocation run_at, 116 ScriptExecutor::WorldType world_type,
117 ScriptExecutor::WorldType world_type, 117 ScriptExecutor::ProcessType process_type,
118 ScriptExecutor::ProcessType process_type, 118 const GURL& webview_src,
119 const GURL& file_url, 119 const GURL& file_url,
120 bool user_gesture, 120 bool user_gesture,
121 ScriptExecutor::ResultType result_type, 121 ScriptExecutor::ResultType result_type,
122 const ExecuteScriptCallback& callback) { 122 const ExecuteScriptCallback& callback) {
123 ExtensionMsg_ExecuteCode_Params params; 123 ExtensionMsg_ExecuteCode_Params params;
124 params.request_id = next_request_id_++; 124 params.request_id = next_request_id_++;
125 params.extension_id = extension_id; 125 params.extension_id = extension_id;
126 params.is_javascript = (script_type == JAVASCRIPT); 126 params.is_javascript = (script_type == JAVASCRIPT);
127 params.code = code; 127 params.code = code;
128 params.all_frames = (frame_scope == ALL_FRAMES); 128 params.all_frames = (frame_scope == ALL_FRAMES);
129 params.run_at = static_cast<int>(run_at); 129 params.run_at = static_cast<int>(run_at);
130 params.in_main_world = (world_type == MAIN_WORLD); 130 params.in_main_world = (world_type == MAIN_WORLD);
131 params.is_web_view = (process_type == WEB_VIEW_PROCESS); 131 params.is_web_view = (process_type == WEB_VIEW_PROCESS);
132 params.webview_src = webview_src;
132 params.file_url = file_url; 133 params.file_url = file_url;
133 params.wants_result = (result_type == JSON_SERIALIZED_RESULT); 134 params.wants_result = (result_type == JSON_SERIALIZED_RESULT);
134 params.user_gesture = user_gesture; 135 params.user_gesture = user_gesture;
135 136
136 // Handler handles IPCs and deletes itself on completion. 137 // Handler handles IPCs and deletes itself on completion.
137 new Handler(script_observers_, web_contents_, params, callback); 138 new Handler(script_observers_, web_contents_, params, callback);
138 } 139 }
139 140
140 } // namespace extensions 141 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/script_executor.h ('k') | chrome/common/extensions/api/webview.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698