OLD | NEW |
1 // Copyright (c) 2011 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/execute_code_in_tab_function.h" | 5 #include "chrome/browser/extensions/execute_code_in_tab_function.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/extension_tab_util.h" | 11 #include "chrome/browser/extensions/extension_tab_util.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 ExtensionMsg_ExecuteCode_Params params; | 220 ExtensionMsg_ExecuteCode_Params params; |
221 params.request_id = request_id(); | 221 params.request_id = request_id(); |
222 params.extension_id = extension->id(); | 222 params.extension_id = extension->id(); |
223 params.is_javascript = is_js_code; | 223 params.is_javascript = is_js_code; |
224 params.code = code_string; | 224 params.code = code_string; |
225 params.all_frames = all_frames_; | 225 params.all_frames = all_frames_; |
226 params.in_main_world = false; | 226 params.in_main_world = false; |
227 contents->web_contents()->GetRenderViewHost()->Send( | 227 contents->web_contents()->GetRenderViewHost()->Send( |
228 new ExtensionMsg_ExecuteCode( | 228 new ExtensionMsg_ExecuteCode( |
229 contents->web_contents()->GetRenderViewHost()->routing_id(), params)); | 229 contents->web_contents()->GetRenderViewHost()->GetRoutingID(), |
| 230 params)); |
230 | 231 |
231 Observe(contents->web_contents()); | 232 Observe(contents->web_contents()); |
232 AddRef(); // balanced in OnExecuteCodeFinished() | 233 AddRef(); // balanced in OnExecuteCodeFinished() |
233 return true; | 234 return true; |
234 } | 235 } |
235 | 236 |
236 bool ExecuteCodeInTabFunction::OnMessageReceived(const IPC::Message& message) { | 237 bool ExecuteCodeInTabFunction::OnMessageReceived(const IPC::Message& message) { |
237 if (message.type() != ExtensionHostMsg_ExecuteCodeFinished::ID) | 238 if (message.type() != ExtensionHostMsg_ExecuteCodeFinished::ID) |
238 return false; | 239 return false; |
239 | 240 |
(...skipping 20 matching lines...) Expand all Loading... |
260 if (!error.empty()) { | 261 if (!error.empty()) { |
261 CHECK(!success); | 262 CHECK(!success); |
262 error_ = error; | 263 error_ = error; |
263 } | 264 } |
264 | 265 |
265 SendResponse(success); | 266 SendResponse(success); |
266 | 267 |
267 Observe(NULL); | 268 Observe(NULL); |
268 Release(); // balanced in Execute() | 269 Release(); // balanced in Execute() |
269 } | 270 } |
OLD | NEW |