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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 #include "extensions/browser/extension_function_dispatcher.h" | 68 #include "extensions/browser/extension_function_dispatcher.h" |
69 #include "extensions/browser/extension_function_util.h" | 69 #include "extensions/browser/extension_function_util.h" |
70 #include "extensions/browser/extension_host.h" | 70 #include "extensions/browser/extension_host.h" |
71 #include "extensions/browser/extension_zoom_request_client.h" | 71 #include "extensions/browser/extension_zoom_request_client.h" |
72 #include "extensions/browser/file_reader.h" | 72 #include "extensions/browser/file_reader.h" |
73 #include "extensions/browser/script_executor.h" | 73 #include "extensions/browser/script_executor.h" |
74 #include "extensions/common/api/extension_types.h" | 74 #include "extensions/common/api/extension_types.h" |
75 #include "extensions/common/constants.h" | 75 #include "extensions/common/constants.h" |
76 #include "extensions/common/error_utils.h" | 76 #include "extensions/common/error_utils.h" |
77 #include "extensions/common/extension.h" | 77 #include "extensions/common/extension.h" |
| 78 #include "extensions/common/host_id.h" |
78 #include "extensions/common/manifest_constants.h" | 79 #include "extensions/common/manifest_constants.h" |
79 #include "extensions/common/manifest_handlers/default_locale_handler.h" | 80 #include "extensions/common/manifest_handlers/default_locale_handler.h" |
80 #include "extensions/common/message_bundle.h" | 81 #include "extensions/common/message_bundle.h" |
81 #include "extensions/common/permissions/permissions_data.h" | 82 #include "extensions/common/permissions/permissions_data.h" |
82 #include "extensions/common/user_script.h" | 83 #include "extensions/common/user_script.h" |
83 #include "skia/ext/image_operations.h" | 84 #include "skia/ext/image_operations.h" |
84 #include "skia/ext/platform_canvas.h" | 85 #include "skia/ext/platform_canvas.h" |
85 #include "third_party/skia/include/core/SkBitmap.h" | 86 #include "third_party/skia/include/core/SkBitmap.h" |
86 #include "ui/base/models/list_selection_model.h" | 87 #include "ui/base/models/list_selection_model.h" |
87 #include "ui/base/ui_base_types.h" | 88 #include "ui/base/ui_base_types.h" |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 extension(), | 1235 extension(), |
1235 web_contents_->GetURL(), | 1236 web_contents_->GetURL(), |
1236 web_contents_->GetURL(), | 1237 web_contents_->GetURL(), |
1237 tab_id, | 1238 tab_id, |
1238 process ? process->GetID() : -1, | 1239 process ? process->GetID() : -1, |
1239 &error_)) { | 1240 &error_)) { |
1240 return false; | 1241 return false; |
1241 } | 1242 } |
1242 | 1243 |
1243 TabHelper::FromWebContents(web_contents_)->script_executor()->ExecuteScript( | 1244 TabHelper::FromWebContents(web_contents_)->script_executor()->ExecuteScript( |
1244 extension_id(), | 1245 HostID(HostID::EXTENSIONS, 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(), |
1254 user_gesture_, | 1255 user_gesture_, |
(...skipping 469 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(HostID(HostID::EXTENSIONS, extension()->id())); |
1734 return true; | 1736 return true; |
1735 } | 1737 } |
1736 | 1738 |
1737 bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { | 1739 bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { |
1738 content::WebContents* contents = NULL; | 1740 content::WebContents* contents = NULL; |
1739 | 1741 |
1740 // If |tab_id| is specified, look for the tab. Otherwise default to selected | 1742 // If |tab_id| is specified, look for the tab. Otherwise default to selected |
1741 // tab in the current window. | 1743 // tab in the current window. |
1742 CHECK_GE(execute_tab_id_, 0); | 1744 CHECK_GE(execute_tab_id_, 0); |
1743 if (!GetTabById(execute_tab_id_, | 1745 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(); | 1953 ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode(); |
1952 api::tabs::ZoomSettings zoom_settings; | 1954 api::tabs::ZoomSettings zoom_settings; |
1953 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); | 1955 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); |
1954 | 1956 |
1955 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); | 1957 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); |
1956 SendResponse(true); | 1958 SendResponse(true); |
1957 return true; | 1959 return true; |
1958 } | 1960 } |
1959 | 1961 |
1960 } // namespace extensions | 1962 } // namespace extensions |
OLD | NEW |