| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 DCHECK(false); | 217 DCHECK(false); |
| 218 } | 218 } |
| 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->render_view_host()->Send(new ExtensionMsg_ExecuteCode( | 227 contents->tab_contents()->render_view_host()->Send( |
| 228 contents->render_view_host()->routing_id(), params)); | 228 new ExtensionMsg_ExecuteCode( |
| 229 contents->tab_contents()->render_view_host()->routing_id(), params)); |
| 229 | 230 |
| 230 Observe(contents->tab_contents()); | 231 Observe(contents->tab_contents()); |
| 231 AddRef(); // balanced in OnExecuteCodeFinished() | 232 AddRef(); // balanced in OnExecuteCodeFinished() |
| 232 return true; | 233 return true; |
| 233 } | 234 } |
| 234 | 235 |
| 235 bool ExecuteCodeInTabFunction::OnMessageReceived(const IPC::Message& message) { | 236 bool ExecuteCodeInTabFunction::OnMessageReceived(const IPC::Message& message) { |
| 236 if (message.type() != ExtensionHostMsg_ExecuteCodeFinished::ID) | 237 if (message.type() != ExtensionHostMsg_ExecuteCodeFinished::ID) |
| 237 return false; | 238 return false; |
| 238 | 239 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 259 if (!error.empty()) { | 260 if (!error.empty()) { |
| 260 CHECK(!success); | 261 CHECK(!success); |
| 261 error_ = error; | 262 error_ = error; |
| 262 } | 263 } |
| 263 | 264 |
| 264 SendResponse(success); | 265 SendResponse(success); |
| 265 | 266 |
| 266 Observe(NULL); | 267 Observe(NULL); |
| 267 Release(); // balanced in Execute() | 268 Release(); // balanced in Execute() |
| 268 } | 269 } |
| OLD | NEW |