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_api.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 GetExtension(), | 1359 GetExtension(), |
1360 web_contents_->GetURL(), | 1360 web_contents_->GetURL(), |
1361 web_contents_->GetURL(), | 1361 web_contents_->GetURL(), |
1362 tab_id, | 1362 tab_id, |
1363 NULL, | 1363 NULL, |
1364 process ? process->GetID() : -1, | 1364 process ? process->GetID() : -1, |
1365 &error_)) { | 1365 &error_)) { |
1366 return false; | 1366 return false; |
1367 } | 1367 } |
1368 | 1368 |
1369 TabHelper::FromWebContents(web_contents_)-> | 1369 TabHelper::FromWebContents(web_contents_)->script_executor()->ExecuteScript( |
1370 script_executor()->ExecuteScript( | 1370 extension_id(), |
1371 extension_id(), | 1371 ScriptExecutor::JAVASCRIPT, |
1372 ScriptExecutor::JAVASCRIPT, | 1372 url.GetContent(), |
1373 url.GetContent(), | 1373 ScriptExecutor::TOP_FRAME, |
1374 ScriptExecutor::TOP_FRAME, | 1374 UserScript::DOCUMENT_IDLE, |
1375 UserScript::DOCUMENT_IDLE, | 1375 ScriptExecutor::MAIN_WORLD, |
1376 ScriptExecutor::MAIN_WORLD, | 1376 ScriptExecutor::DEFAULT_PROCESS, |
1377 ScriptExecutor::DEFAULT_PROCESS, | 1377 GURL(), |
1378 GURL(), | 1378 GURL(), |
1379 user_gesture_, | 1379 user_gesture_, |
1380 ScriptExecutor::NO_RESULT, | 1380 ScriptExecutor::NO_RESULT, |
1381 base::Bind(&TabsUpdateFunction::OnExecuteCodeFinished, this)); | 1381 base::Bind(&TabsUpdateFunction::OnExecuteCodeFinished, this)); |
1382 | 1382 |
1383 *is_async = true; | 1383 *is_async = true; |
1384 return true; | 1384 return true; |
1385 } | 1385 } |
1386 | 1386 |
1387 web_contents_->GetController().LoadURL( | 1387 web_contents_->GetController().LoadURL( |
1388 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); | 1388 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); |
1389 | 1389 |
1390 // The URL of a tab contents never actually changes to a JavaScript URL, so | 1390 // The URL of a tab contents never actually changes to a JavaScript URL, so |
1391 // this check only makes sense in other cases. | 1391 // this check only makes sense in other cases. |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 if (!success) | 1858 if (!success) |
1859 return NULL; | 1859 return NULL; |
1860 | 1860 |
1861 return TabHelper::FromWebContents(contents)->script_executor(); | 1861 return TabHelper::FromWebContents(contents)->script_executor(); |
1862 } | 1862 } |
1863 | 1863 |
1864 bool ExecuteCodeInTabFunction::IsWebView() const { | 1864 bool ExecuteCodeInTabFunction::IsWebView() const { |
1865 return false; | 1865 return false; |
1866 } | 1866 } |
1867 | 1867 |
| 1868 const GURL& ExecuteCodeInTabFunction::GetWebViewSrc() const { |
| 1869 return GURL::EmptyGURL(); |
| 1870 } |
| 1871 |
1868 bool TabsExecuteScriptFunction::ShouldInsertCSS() const { | 1872 bool TabsExecuteScriptFunction::ShouldInsertCSS() const { |
1869 return false; | 1873 return false; |
1870 } | 1874 } |
1871 | 1875 |
1872 void TabsExecuteScriptFunction::OnExecuteCodeFinished( | 1876 void TabsExecuteScriptFunction::OnExecuteCodeFinished( |
1873 const std::string& error, | 1877 const std::string& error, |
1874 int32 on_page_id, | 1878 int32 on_page_id, |
1875 const GURL& on_url, | 1879 const GURL& on_url, |
1876 const base::ListValue& result) { | 1880 const base::ListValue& result) { |
1877 if (error.empty()) | 1881 if (error.empty()) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 execute_tab_id_ = tab_id; | 1915 execute_tab_id_ = tab_id; |
1912 details_ = details.Pass(); | 1916 details_ = details.Pass(); |
1913 return true; | 1917 return true; |
1914 } | 1918 } |
1915 | 1919 |
1916 bool TabsInsertCSSFunction::ShouldInsertCSS() const { | 1920 bool TabsInsertCSSFunction::ShouldInsertCSS() const { |
1917 return true; | 1921 return true; |
1918 } | 1922 } |
1919 | 1923 |
1920 } // namespace extensions | 1924 } // namespace extensions |
OLD | NEW |