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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 extension(), | 1234 extension(), |
1235 web_contents_->GetURL(), | 1235 web_contents_->GetURL(), |
1236 web_contents_->GetURL(), | 1236 web_contents_->GetURL(), |
1237 tab_id, | 1237 tab_id, |
1238 process ? process->GetID() : -1, | 1238 process ? process->GetID() : -1, |
1239 &error_)) { | 1239 &error_)) { |
1240 return false; | 1240 return false; |
1241 } | 1241 } |
1242 | 1242 |
1243 TabHelper::FromWebContents(web_contents_)->script_executor()->ExecuteScript( | 1243 TabHelper::FromWebContents(web_contents_)->script_executor()->ExecuteScript( |
| 1244 HostID::EXTENSIONS, |
1244 extension_id(), | 1245 extension_id(), |
1245 ScriptExecutor::JAVASCRIPT, | 1246 ScriptExecutor::JAVASCRIPT, |
1246 url.GetContent(), | 1247 url.GetContent(), |
1247 ScriptExecutor::TOP_FRAME, | 1248 ScriptExecutor::TOP_FRAME, |
1248 ScriptExecutor::DONT_MATCH_ABOUT_BLANK, | 1249 ScriptExecutor::DONT_MATCH_ABOUT_BLANK, |
1249 UserScript::DOCUMENT_IDLE, | 1250 UserScript::DOCUMENT_IDLE, |
1250 ScriptExecutor::MAIN_WORLD, | 1251 ScriptExecutor::MAIN_WORLD, |
1251 ScriptExecutor::DEFAULT_PROCESS, | 1252 ScriptExecutor::DEFAULT_PROCESS, |
1252 GURL(), | 1253 GURL(), |
1253 GURL(), | 1254 GURL(), |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1724 Browser* browser = chrome_details_.GetCurrentBrowser(); | 1725 Browser* browser = chrome_details_.GetCurrentBrowser(); |
1725 if (!browser) | 1726 if (!browser) |
1726 return false; | 1727 return false; |
1727 content::WebContents* web_contents = NULL; | 1728 content::WebContents* web_contents = NULL; |
1728 if (!ExtensionTabUtil::GetDefaultTab(browser, &web_contents, &tab_id)) | 1729 if (!ExtensionTabUtil::GetDefaultTab(browser, &web_contents, &tab_id)) |
1729 return false; | 1730 return false; |
1730 } | 1731 } |
1731 | 1732 |
1732 execute_tab_id_ = tab_id; | 1733 execute_tab_id_ = tab_id; |
1733 details_ = details.Pass(); | 1734 details_ = details.Pass(); |
| 1735 set_host_id(make_scoped_ptr(new HostID(HostID::EXTENSIONS, |
| 1736 extension()->id()))); |
1734 return true; | 1737 return true; |
1735 } | 1738 } |
1736 | 1739 |
1737 bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { | 1740 bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { |
1738 content::WebContents* contents = NULL; | 1741 content::WebContents* contents = NULL; |
1739 | 1742 |
1740 // If |tab_id| is specified, look for the tab. Otherwise default to selected | 1743 // If |tab_id| is specified, look for the tab. Otherwise default to selected |
1741 // tab in the current window. | 1744 // tab in the current window. |
1742 CHECK_GE(execute_tab_id_, 0); | 1745 CHECK_GE(execute_tab_id_, 0); |
1743 if (!GetTabById(execute_tab_id_, | 1746 if (!GetTabById(execute_tab_id_, |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode(); | 1954 ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode(); |
1952 api::tabs::ZoomSettings zoom_settings; | 1955 api::tabs::ZoomSettings zoom_settings; |
1953 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); | 1956 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); |
1954 | 1957 |
1955 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); | 1958 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); |
1956 SendResponse(true); | 1959 SendResponse(true); |
1957 return true; | 1960 return true; |
1958 } | 1961 } |
1959 | 1962 |
1960 } // namespace extensions | 1963 } // namespace extensions |
OLD | NEW |