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/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" |
12 #include "chrome/browser/extensions/extension_tab_helper.h" | |
13 #include "chrome/browser/extensions/extension_tabs_module.h" | 12 #include "chrome/browser/extensions/extension_tabs_module.h" |
14 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 13 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
15 #include "chrome/browser/extensions/file_reader.h" | 14 #include "chrome/browser/extensions/file_reader.h" |
16 #include "chrome/browser/extensions/script_executor.h" | 15 #include "chrome/browser/extensions/script_executor.h" |
17 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
20 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
21 #include "chrome/common/extensions/extension_constants.h" | 20 #include "chrome/common/extensions/extension_constants.h" |
22 #include "chrome/common/extensions/extension_error_utils.h" | 21 #include "chrome/common/extensions/extension_error_utils.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 237 } |
239 | 238 |
240 ScriptExecutor::ScriptType script_type = ScriptExecutor::JAVASCRIPT; | 239 ScriptExecutor::ScriptType script_type = ScriptExecutor::JAVASCRIPT; |
241 std::string function_name = name(); | 240 std::string function_name = name(); |
242 if (function_name == TabsInsertCSSFunction::function_name()) { | 241 if (function_name == TabsInsertCSSFunction::function_name()) { |
243 script_type = ScriptExecutor::CSS; | 242 script_type = ScriptExecutor::CSS; |
244 } else if (function_name != TabsExecuteScriptFunction::function_name()) { | 243 } else if (function_name != TabsExecuteScriptFunction::function_name()) { |
245 NOTREACHED(); | 244 NOTREACHED(); |
246 } | 245 } |
247 | 246 |
248 contents->extension_tab_helper()->script_executor()->ExecuteScript( | 247 contents->extension_script_executor()->ExecuteScript( |
249 extension->id(), | 248 extension->id(), |
250 script_type, | 249 script_type, |
251 code_string, | 250 code_string, |
252 all_frames_ ? ScriptExecutor::ALL_FRAMES : ScriptExecutor::TOP_FRAME, | 251 all_frames_ ? ScriptExecutor::ALL_FRAMES : ScriptExecutor::TOP_FRAME, |
253 run_at_, | 252 run_at_, |
254 ScriptExecutor::ISOLATED_WORLD, | 253 ScriptExecutor::ISOLATED_WORLD, |
255 base::Bind(&ExecuteCodeInTabFunction::OnExecuteCodeFinished, this)); | 254 base::Bind(&ExecuteCodeInTabFunction::OnExecuteCodeFinished, this)); |
256 return true; | 255 return true; |
257 } | 256 } |
OLD | NEW |