| OLD | NEW |
| 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 "chrome/common/extensions/extension_messages.h" | 10 #include "chrome/common/extensions/extension_messages.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 ScriptExecutor::~ScriptExecutor() {} | 109 ScriptExecutor::~ScriptExecutor() {} |
| 110 | 110 |
| 111 void ScriptExecutor::ExecuteScript( | 111 void ScriptExecutor::ExecuteScript( |
| 112 const std::string& extension_id, | 112 const std::string& extension_id, |
| 113 ScriptExecutor::ScriptType script_type, | 113 ScriptExecutor::ScriptType script_type, |
| 114 const std::string& code, | 114 const std::string& code, |
| 115 ScriptExecutor::FrameScope frame_scope, | 115 ScriptExecutor::FrameScope frame_scope, |
| 116 UserScript::RunLocation run_at, | 116 UserScript::RunLocation run_at, |
| 117 ScriptExecutor::WorldType world_type, | 117 ScriptExecutor::WorldType world_type, |
| 118 bool is_web_view, |
| 118 const ExecuteScriptCallback& callback) { | 119 const ExecuteScriptCallback& callback) { |
| 119 ExtensionMsg_ExecuteCode_Params params; | 120 ExtensionMsg_ExecuteCode_Params params; |
| 120 params.request_id = next_request_id_++; | 121 params.request_id = next_request_id_++; |
| 121 params.extension_id = extension_id; | 122 params.extension_id = extension_id; |
| 122 params.is_javascript = (script_type == JAVASCRIPT); | 123 params.is_javascript = (script_type == JAVASCRIPT); |
| 123 params.code = code; | 124 params.code = code; |
| 124 params.all_frames = (frame_scope == ALL_FRAMES); | 125 params.all_frames = (frame_scope == ALL_FRAMES); |
| 125 params.run_at = static_cast<int>(run_at); | 126 params.run_at = static_cast<int>(run_at); |
| 126 params.in_main_world = (world_type == MAIN_WORLD); | 127 params.in_main_world = (world_type == MAIN_WORLD); |
| 128 params.is_web_view = is_web_view; |
| 127 | 129 |
| 128 // Handler handles IPCs and deletes itself on completion. | 130 // Handler handles IPCs and deletes itself on completion. |
| 129 new Handler(script_observers_, web_contents_, params, callback); | 131 new Handler(script_observers_, web_contents_, params, callback); |
| 130 } | 132 } |
| 131 | 133 |
| 132 } // namespace extensions | 134 } // namespace extensions |
| OLD | NEW |