| 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 ScriptExecutor::ProcessType process_type, |
| 119 ScriptExecutor::ResultType result_type, |
| 119 const ExecuteScriptCallback& callback) { | 120 const ExecuteScriptCallback& callback) { |
| 120 ExtensionMsg_ExecuteCode_Params params; | 121 ExtensionMsg_ExecuteCode_Params params; |
| 121 params.request_id = next_request_id_++; | 122 params.request_id = next_request_id_++; |
| 122 params.extension_id = extension_id; | 123 params.extension_id = extension_id; |
| 123 params.is_javascript = (script_type == JAVASCRIPT); | 124 params.is_javascript = (script_type == JAVASCRIPT); |
| 124 params.code = code; | 125 params.code = code; |
| 125 params.all_frames = (frame_scope == ALL_FRAMES); | 126 params.all_frames = (frame_scope == ALL_FRAMES); |
| 126 params.run_at = static_cast<int>(run_at); | 127 params.run_at = static_cast<int>(run_at); |
| 127 params.in_main_world = (world_type == MAIN_WORLD); | 128 params.in_main_world = (world_type == MAIN_WORLD); |
| 128 params.is_web_view = is_web_view; | 129 params.is_web_view = (process_type == WEB_VIEW_PROCESS); |
| 130 params.wants_result = (result_type == JSON_SERIALIZED_RESULT); |
| 129 | 131 |
| 130 // Handler handles IPCs and deletes itself on completion. | 132 // Handler handles IPCs and deletes itself on completion. |
| 131 new Handler(script_observers_, web_contents_, params, callback); | 133 new Handler(script_observers_, web_contents_, params, callback); |
| 132 } | 134 } |
| 133 | 135 |
| 134 } // namespace extensions | 136 } // namespace extensions |
| OLD | NEW |