| 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 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // Set a flag to tell ChromeVox that it's just been enabled, | 255 // Set a flag to tell ChromeVox that it's just been enabled, |
| 256 // so that it won't interrupt our speech feedback enabled message. | 256 // so that it won't interrupt our speech feedback enabled message. |
| 257 ExecuteScriptHelper(render_view_host, "window.INJECTED_AFTER_LOAD = true;", | 257 ExecuteScriptHelper(render_view_host, "window.INJECTED_AFTER_LOAD = true;", |
| 258 extension->id()); | 258 extension->id()); |
| 259 | 259 |
| 260 // Inject ChromeVox' content scripts. | 260 // Inject ChromeVox' content scripts. |
| 261 ContentScriptLoader* loader = new ContentScriptLoader( | 261 ContentScriptLoader* loader = new ContentScriptLoader( |
| 262 extension->id(), render_view_host->GetProcess()->GetID(), | 262 extension->id(), render_view_host->GetProcess()->GetID(), |
| 263 render_view_host->GetRoutingID()); | 263 render_view_host->GetRoutingID()); |
| 264 | 264 |
| 265 const extensions::UserScriptList& content_scripts = | 265 const extensions::ScriptMetadataList& content_scripts = |
| 266 extensions::ContentScriptsInfo::GetContentScripts(extension); | 266 extensions::ContentScriptsInfo::GetContentScripts(extension); |
| 267 for (size_t i = 0; i < content_scripts.size(); i++) { | 267 for (size_t i = 0; i < content_scripts.size(); i++) { |
| 268 const extensions::UserScript& script = content_scripts[i]; | 268 const std::unique_ptr<extensions::ScriptMetadata>& script = |
| 269 if (web_contents && !script.MatchesURL(content_url)) | 269 content_scripts[i]; |
| 270 if (web_contents && !script->MatchesURL(content_url)) |
| 270 continue; | 271 continue; |
| 271 for (size_t j = 0; j < script.js_scripts().size(); ++j) { | 272 for (size_t j = 0; j < script->js_scripts().size(); ++j) { |
| 272 const extensions::UserScript::File& file = script.js_scripts()[j]; | 273 const std::unique_ptr<extensions::UserScriptFileInfo>& file = |
| 273 extensions::ExtensionResource resource = extension->GetResource( | 274 script->js_scripts()[j]; |
| 274 file.relative_path()); | 275 extensions::ExtensionResource resource = |
| 276 extension->GetResource(file->relative_path()); |
| 275 loader->AppendScript(resource); | 277 loader->AppendScript(resource); |
| 276 } | 278 } |
| 277 } | 279 } |
| 278 loader->Run(); // It cleans itself up when done. | 280 loader->Run(); // It cleans itself up when done. |
| 279 } | 281 } |
| 280 | 282 |
| 281 void UnloadChromeVoxExtension(Profile* profile) { | 283 void UnloadChromeVoxExtension(Profile* profile) { |
| 282 base::FilePath path = GetChromeVoxPath(); | 284 base::FilePath path = GetChromeVoxPath(); |
| 283 ExtensionService* extension_service = | 285 ExtensionService* extension_service = |
| 284 extensions::ExtensionSystem::Get(profile)->extension_service(); | 286 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| (...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 content::BrowserContext* context) { | 1543 content::BrowserContext* context) { |
| 1542 keyboard_listener_extension_id_ = id; | 1544 keyboard_listener_extension_id_ = id; |
| 1543 | 1545 |
| 1544 extensions::ExtensionRegistry* registry = | 1546 extensions::ExtensionRegistry* registry = |
| 1545 extensions::ExtensionRegistry::Get(context); | 1547 extensions::ExtensionRegistry::Get(context); |
| 1546 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1548 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
| 1547 extension_registry_observer_.Add(registry); | 1549 extension_registry_observer_.Add(registry); |
| 1548 } | 1550 } |
| 1549 | 1551 |
| 1550 } // namespace chromeos | 1552 } // namespace chromeos |
| OLD | NEW |