Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_manager.cc

Issue 2227193002: Make UserScript non-copyable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove browser/renderer specific file impl as it is not helping much Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 ExecuteScriptHelper(render_view_host, "window.INJECTED_AFTER_LOAD = true;", 258 ExecuteScriptHelper(render_view_host, "window.INJECTED_AFTER_LOAD = true;",
259 extension->id()); 259 extension->id());
260 260
261 // Inject ChromeVox' content scripts. 261 // Inject ChromeVox' content scripts.
262 ContentScriptLoader* loader = new ContentScriptLoader( 262 ContentScriptLoader* loader = new ContentScriptLoader(
263 extension->id(), render_view_host->GetProcess()->GetID(), 263 extension->id(), render_view_host->GetProcess()->GetID(),
264 render_view_host->GetRoutingID()); 264 render_view_host->GetRoutingID());
265 265
266 const extensions::UserScriptList& content_scripts = 266 const extensions::UserScriptList& content_scripts =
267 extensions::ContentScriptsInfo::GetContentScripts(extension); 267 extensions::ContentScriptsInfo::GetContentScripts(extension);
268 for (size_t i = 0; i < content_scripts.size(); i++) { 268 for (const std::unique_ptr<extensions::UserScript>& script :
269 const extensions::UserScript& script = content_scripts[i]; 269 content_scripts) {
270 if (web_contents && !script.MatchesURL(content_url)) 270 if (web_contents && !script->MatchesURL(content_url))
271 continue; 271 continue;
272 for (size_t j = 0; j < script.js_scripts().size(); ++j) { 272 for (size_t j = 0; j < script->js_scripts().size(); ++j) {
273 const extensions::UserScript::File& file = script.js_scripts()[j]; 273 const std::unique_ptr<extensions::UserScriptFile>& file =
Devlin 2016/08/17 16:39:30 nit: maybe update this to range-based for loop, to
lazyboy 2016/08/17 18:55:51 Done.
274 extensions::ExtensionResource resource = extension->GetResource( 274 script->js_scripts()[j];
275 file.relative_path()); 275 extensions::ExtensionResource resource =
276 extension->GetResource(file->relative_path());
276 loader->AppendScript(resource); 277 loader->AppendScript(resource);
277 } 278 }
278 } 279 }
279 loader->Run(); // It cleans itself up when done. 280 loader->Run(); // It cleans itself up when done.
280 } 281 }
281 282
282 void UnloadChromeVoxExtension(Profile* profile) { 283 void UnloadChromeVoxExtension(Profile* profile) {
283 base::FilePath path = GetChromeVoxPath(); 284 base::FilePath path = GetChromeVoxPath();
284 ExtensionService* extension_service = 285 ExtensionService* extension_service =
285 extensions::ExtensionSystem::Get(profile)->extension_service(); 286 extensions::ExtensionSystem::Get(profile)->extension_service();
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 content::BrowserContext* context) { 1544 content::BrowserContext* context) {
1544 keyboard_listener_extension_id_ = id; 1545 keyboard_listener_extension_id_ = id;
1545 1546
1546 extensions::ExtensionRegistry* registry = 1547 extensions::ExtensionRegistry* registry =
1547 extensions::ExtensionRegistry::Get(context); 1548 extensions::ExtensionRegistry::Get(context);
1548 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) 1549 if (!extension_registry_observer_.IsObserving(registry) && !id.empty())
1549 extension_registry_observer_.Add(registry); 1550 extension_registry_observer_.Add(registry);
1550 } 1551 }
1551 1552
1552 } // namespace chromeos 1553 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698