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/extension_tabs_module.h" | 5 #include "chrome/browser/extensions/extension_tabs_module.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 } | 1313 } |
1314 | 1314 |
1315 // JavaScript URLs can do the same kinds of things as cross-origin XHR, so | 1315 // JavaScript URLs can do the same kinds of things as cross-origin XHR, so |
1316 // we need to check host permissions before allowing them. | 1316 // we need to check host permissions before allowing them. |
1317 if (url.SchemeIs(chrome::kJavaScriptScheme)) { | 1317 if (url.SchemeIs(chrome::kJavaScriptScheme)) { |
1318 if (!GetExtension()->CanExecuteScriptOnPage( | 1318 if (!GetExtension()->CanExecuteScriptOnPage( |
1319 tab_contents_->web_contents()->GetURL(), NULL, &error_)) { | 1319 tab_contents_->web_contents()->GetURL(), NULL, &error_)) { |
1320 return false; | 1320 return false; |
1321 } | 1321 } |
1322 | 1322 |
1323 tab_contents_->extension_script_executor()->ExecuteScript( | 1323 tab_contents_->extension_tab_helper()->script_executor()->ExecuteScript( |
1324 extension_id(), | 1324 extension_id(), |
1325 ScriptExecutor::JAVASCRIPT, | 1325 ScriptExecutor::JAVASCRIPT, |
1326 url.path(), | 1326 url.path(), |
1327 ScriptExecutor::TOP_FRAME, | 1327 ScriptExecutor::TOP_FRAME, |
1328 UserScript::DOCUMENT_IDLE, | 1328 UserScript::DOCUMENT_IDLE, |
1329 ScriptExecutor::MAIN_WORLD, | 1329 ScriptExecutor::MAIN_WORLD, |
1330 base::Bind(&UpdateTabFunction::OnExecuteCodeFinished, this)); | 1330 base::Bind(&UpdateTabFunction::OnExecuteCodeFinished, this)); |
1331 | 1331 |
1332 *is_async = true; | 1332 *is_async = true; |
1333 return true; | 1333 return true; |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 // called for every API call the extension made. | 1816 // called for every API call the extension made. |
1817 GotLanguage(language); | 1817 GotLanguage(language); |
1818 } | 1818 } |
1819 | 1819 |
1820 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1820 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
1821 result_.reset(Value::CreateStringValue(language.c_str())); | 1821 result_.reset(Value::CreateStringValue(language.c_str())); |
1822 SendResponse(true); | 1822 SendResponse(true); |
1823 | 1823 |
1824 Release(); // Balanced in Run() | 1824 Release(); // Balanced in Run() |
1825 } | 1825 } |
OLD | NEW |