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