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