| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 41 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 42 #include "chrome/browser/ui/window_sizer.h" | 42 #include "chrome/browser/ui/window_sizer.h" |
| 43 #include "chrome/browser/web_applications/web_app.h" | 43 #include "chrome/browser/web_applications/web_app.h" |
| 44 #include "chrome/common/chrome_notification_types.h" | 44 #include "chrome/common/chrome_notification_types.h" |
| 45 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
| 46 #include "chrome/common/extensions/api/windows.h" | 46 #include "chrome/common/extensions/api/windows.h" |
| 47 #include "chrome/common/extensions/extension.h" | 47 #include "chrome/common/extensions/extension.h" |
| 48 #include "chrome/common/extensions/extension_manifest_constants.h" | 48 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 49 #include "chrome/common/extensions/extension_error_utils.h" | 49 #include "chrome/common/extensions/extension_error_utils.h" |
| 50 #include "chrome/common/extensions/extension_messages.h" | 50 #include "chrome/common/extensions/extension_messages.h" |
| 51 #include "chrome/common/extensions/user_script.h" |
| 51 #include "chrome/common/pref_names.h" | 52 #include "chrome/common/pref_names.h" |
| 52 #include "chrome/common/url_constants.h" | 53 #include "chrome/common/url_constants.h" |
| 53 #include "content/public/browser/navigation_controller.h" | 54 #include "content/public/browser/navigation_controller.h" |
| 54 #include "content/public/browser/navigation_entry.h" | 55 #include "content/public/browser/navigation_entry.h" |
| 55 #include "content/public/browser/notification_details.h" | 56 #include "content/public/browser/notification_details.h" |
| 56 #include "content/public/browser/notification_source.h" | 57 #include "content/public/browser/notification_source.h" |
| 57 #include "content/public/browser/render_view_host.h" | 58 #include "content/public/browser/render_view_host.h" |
| 58 #include "content/public/browser/render_view_host_delegate.h" | 59 #include "content/public/browser/render_view_host_delegate.h" |
| 59 #include "content/public/browser/web_contents.h" | 60 #include "content/public/browser/web_contents.h" |
| 60 #include "content/public/browser/web_contents_view.h" | 61 #include "content/public/browser/web_contents_view.h" |
| (...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 if (!GetExtension()->CanExecuteScriptOnPage( | 1307 if (!GetExtension()->CanExecuteScriptOnPage( |
| 1307 web_contents_->GetURL(), NULL, &error_)) { | 1308 web_contents_->GetURL(), NULL, &error_)) { |
| 1308 return false; | 1309 return false; |
| 1309 } | 1310 } |
| 1310 | 1311 |
| 1311 ExtensionMsg_ExecuteCode_Params params; | 1312 ExtensionMsg_ExecuteCode_Params params; |
| 1312 params.request_id = request_id(); | 1313 params.request_id = request_id(); |
| 1313 params.extension_id = extension_id(); | 1314 params.extension_id = extension_id(); |
| 1314 params.is_javascript = true; | 1315 params.is_javascript = true; |
| 1315 params.code = url.path(); | 1316 params.code = url.path(); |
| 1317 params.run_at = UserScript::DOCUMENT_IDLE; |
| 1316 params.all_frames = false; | 1318 params.all_frames = false; |
| 1317 params.in_main_world = true; | 1319 params.in_main_world = true; |
| 1318 | 1320 |
| 1319 RenderViewHost* render_view_host = web_contents_->GetRenderViewHost(); | 1321 RenderViewHost* render_view_host = web_contents_->GetRenderViewHost(); |
| 1320 render_view_host->Send( | 1322 render_view_host->Send( |
| 1321 new ExtensionMsg_ExecuteCode(render_view_host->GetRoutingID(), params)); | 1323 new ExtensionMsg_ExecuteCode(render_view_host->GetRoutingID(), params)); |
| 1322 | 1324 |
| 1323 Observe(web_contents_); | 1325 Observe(web_contents_); |
| 1324 AddRef(); // Balanced in OnExecuteCodeFinished(). | 1326 AddRef(); // Balanced in OnExecuteCodeFinished(). |
| 1325 | 1327 |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 // called for every API call the extension made. | 1824 // called for every API call the extension made. |
| 1823 GotLanguage(language); | 1825 GotLanguage(language); |
| 1824 } | 1826 } |
| 1825 | 1827 |
| 1826 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1828 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
| 1827 result_.reset(Value::CreateStringValue(language.c_str())); | 1829 result_.reset(Value::CreateStringValue(language.c_str())); |
| 1828 SendResponse(true); | 1830 SendResponse(true); |
| 1829 | 1831 |
| 1830 Release(); // Balanced in Run() | 1832 Release(); // Balanced in Run() |
| 1831 } | 1833 } |
| OLD | NEW |