| 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/api/tabs/tabs.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 if (!GetExtension()->CanExecuteScriptOnPage( | 1308 if (!GetExtension()->CanExecuteScriptOnPage( |
| 1309 tab_contents_->web_contents()->GetURL(), tab_id, NULL, &error_)) { | 1309 tab_contents_->web_contents()->GetURL(), tab_id, NULL, &error_)) { |
| 1310 return false; | 1310 return false; |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 tab_contents_->extension_tab_helper()->script_executor()->ExecuteScript( | 1313 tab_contents_->extension_tab_helper()->script_executor()->ExecuteScript( |
| 1314 extension_id(), | 1314 extension_id(), |
| 1315 ScriptExecutor::JAVASCRIPT, | 1315 ScriptExecutor::JAVASCRIPT, |
| 1316 url.path(), | 1316 url.path(), |
| 1317 ScriptExecutor::TOP_FRAME, | 1317 ScriptExecutor::TOP_FRAME, |
| 1318 UserScript::DOCUMENT_IDLE, | 1318 extensions::UserScript::DOCUMENT_IDLE, |
| 1319 ScriptExecutor::MAIN_WORLD, | 1319 ScriptExecutor::MAIN_WORLD, |
| 1320 base::Bind(&UpdateTabFunction::OnExecuteCodeFinished, this)); | 1320 base::Bind(&UpdateTabFunction::OnExecuteCodeFinished, this)); |
| 1321 | 1321 |
| 1322 *is_async = true; | 1322 *is_async = true; |
| 1323 return true; | 1323 return true; |
| 1324 } | 1324 } |
| 1325 | 1325 |
| 1326 tab_contents_->web_contents()->GetController().LoadURL( | 1326 tab_contents_->web_contents()->GetController().LoadURL( |
| 1327 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); | 1327 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); |
| 1328 | 1328 |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 // called for every API call the extension made. | 1809 // called for every API call the extension made. |
| 1810 GotLanguage(language); | 1810 GotLanguage(language); |
| 1811 } | 1811 } |
| 1812 | 1812 |
| 1813 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1813 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
| 1814 SetResult(Value::CreateStringValue(language.c_str())); | 1814 SetResult(Value::CreateStringValue(language.c_str())); |
| 1815 SendResponse(true); | 1815 SendResponse(true); |
| 1816 | 1816 |
| 1817 Release(); // Balanced in Run() | 1817 Release(); // Balanced in Run() |
| 1818 } | 1818 } |
| OLD | NEW |