| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/accessibility/accessibility_manager.h" | 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "content/public/browser/browser_thread.h" | 60 #include "content/public/browser/browser_thread.h" |
| 61 #include "content/public/browser/notification_details.h" | 61 #include "content/public/browser/notification_details.h" |
| 62 #include "content/public/browser/notification_service.h" | 62 #include "content/public/browser/notification_service.h" |
| 63 #include "content/public/browser/notification_source.h" | 63 #include "content/public/browser/notification_source.h" |
| 64 #include "content/public/browser/render_process_host.h" | 64 #include "content/public/browser/render_process_host.h" |
| 65 #include "content/public/browser/render_view_host.h" | 65 #include "content/public/browser/render_view_host.h" |
| 66 #include "content/public/browser/web_contents.h" | 66 #include "content/public/browser/web_contents.h" |
| 67 #include "content/public/browser/web_ui.h" | 67 #include "content/public/browser/web_ui.h" |
| 68 #include "content/public/common/content_switches.h" | 68 #include "content/public/common/content_switches.h" |
| 69 #include "extensions/browser/event_router.h" | 69 #include "extensions/browser/event_router.h" |
| 70 #include "extensions/browser/extension_api_frame_id_map.h" |
| 70 #include "extensions/browser/extension_registry.h" | 71 #include "extensions/browser/extension_registry.h" |
| 71 #include "extensions/browser/extension_system.h" | 72 #include "extensions/browser/extension_system.h" |
| 72 #include "extensions/browser/file_reader.h" | 73 #include "extensions/browser/file_reader.h" |
| 73 #include "extensions/browser/script_executor.h" | 74 #include "extensions/browser/script_executor.h" |
| 74 #include "extensions/common/extension.h" | 75 #include "extensions/common/extension.h" |
| 75 #include "extensions/common/extension_messages.h" | 76 #include "extensions/common/extension_messages.h" |
| 76 #include "extensions/common/extension_resource.h" | 77 #include "extensions/common/extension_resource.h" |
| 77 #include "extensions/common/host_id.h" | 78 #include "extensions/common/host_id.h" |
| 78 #include "media/audio/sounds/sounds_manager.h" | 79 #include "media/audio/sounds/sounds_manager.h" |
| 79 #include "ui/base/ime/chromeos/input_method_manager.h" | 80 #include "ui/base/ime/chromeos/input_method_manager.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 void ExecuteScriptHelper( | 121 void ExecuteScriptHelper( |
| 121 content::RenderViewHost* render_view_host, | 122 content::RenderViewHost* render_view_host, |
| 122 const std::string& code, | 123 const std::string& code, |
| 123 const std::string& extension_id) { | 124 const std::string& extension_id) { |
| 124 content::WebContents* web_contents = | 125 content::WebContents* web_contents = |
| 125 content::WebContents::FromRenderViewHost(render_view_host); | 126 content::WebContents::FromRenderViewHost(render_view_host); |
| 126 if (!web_contents) | 127 if (!web_contents) |
| 127 return; | 128 return; |
| 128 if (!extensions::TabHelper::FromWebContents(web_contents)) | 129 if (!extensions::TabHelper::FromWebContents(web_contents)) |
| 129 extensions::TabHelper::CreateForWebContents(web_contents); | 130 extensions::TabHelper::CreateForWebContents(web_contents); |
| 130 extensions::TabHelper::FromWebContents(web_contents)->script_executor()-> | 131 extensions::TabHelper::FromWebContents(web_contents) |
| 131 ExecuteScript(HostID(HostID::EXTENSIONS, extension_id), | 132 ->script_executor() |
| 132 extensions::ScriptExecutor::JAVASCRIPT, | 133 ->ExecuteScript(HostID(HostID::EXTENSIONS, extension_id), |
| 133 code, | 134 extensions::ScriptExecutor::JAVASCRIPT, code, |
| 134 extensions::ScriptExecutor::ALL_FRAMES, | 135 extensions::ScriptExecutor::INCLUDE_SUB_FRAMES, |
| 135 extensions::ScriptExecutor::DONT_MATCH_ABOUT_BLANK, | 136 extensions::ExtensionApiFrameIdMap::kTopFrameId, |
| 136 extensions::UserScript::DOCUMENT_IDLE, | 137 extensions::ScriptExecutor::DONT_MATCH_ABOUT_BLANK, |
| 137 extensions::ScriptExecutor::ISOLATED_WORLD, | 138 extensions::UserScript::DOCUMENT_IDLE, |
| 138 extensions::ScriptExecutor::DEFAULT_PROCESS, | 139 extensions::ScriptExecutor::ISOLATED_WORLD, |
| 139 GURL(), // No webview src. | 140 extensions::ScriptExecutor::DEFAULT_PROCESS, |
| 140 GURL(), // No file url. | 141 GURL(), // No webview src. |
| 141 false, // Not user gesture. | 142 GURL(), // No file url. |
| 142 extensions::ScriptExecutor::NO_RESULT, | 143 false, // Not user gesture. |
| 143 extensions::ScriptExecutor::ExecuteScriptCallback()); | 144 extensions::ScriptExecutor::NO_RESULT, |
| 145 extensions::ScriptExecutor::ExecuteScriptCallback()); |
| 144 } | 146 } |
| 145 | 147 |
| 146 // Helper class that directly loads an extension's content scripts into | 148 // Helper class that directly loads an extension's content scripts into |
| 147 // all of the frames corresponding to a given RenderViewHost. | 149 // all of the frames corresponding to a given RenderViewHost. |
| 148 class ContentScriptLoader { | 150 class ContentScriptLoader { |
| 149 public: | 151 public: |
| 150 // Initialize the ContentScriptLoader with the ID of the extension | 152 // Initialize the ContentScriptLoader with the ID of the extension |
| 151 // and the RenderViewHost where the scripts should be loaded. | 153 // and the RenderViewHost where the scripts should be loaded. |
| 152 ContentScriptLoader(const std::string& extension_id, | 154 ContentScriptLoader(const std::string& extension_id, |
| 153 int render_process_id, | 155 int render_process_id, |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 content::BrowserContext* context) { | 1234 content::BrowserContext* context) { |
| 1233 keyboard_listener_extension_id_ = id; | 1235 keyboard_listener_extension_id_ = id; |
| 1234 | 1236 |
| 1235 extensions::ExtensionRegistry* registry = | 1237 extensions::ExtensionRegistry* registry = |
| 1236 extensions::ExtensionRegistry::Get(context); | 1238 extensions::ExtensionRegistry::Get(context); |
| 1237 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1239 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
| 1238 extension_registry_observer_.Add(registry); | 1240 extension_registry_observer_.Add(registry); |
| 1239 } | 1241 } |
| 1240 | 1242 |
| 1241 } // namespace chromeos | 1243 } // namespace chromeos |
| OLD | NEW |