OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/user_script_loader.h" | 5 #include "chrome/browser/extensions/user_script_loader.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 added_script_ids.insert(it->id()); | 340 added_script_ids.insert(it->id()); |
341 } | 341 } |
342 LoadUserScripts( | 342 LoadUserScripts( |
343 user_scripts, info, added_script_ids, NULL /* no verifier for testing */); | 343 user_scripts, info, added_script_ids, NULL /* no verifier for testing */); |
344 } | 344 } |
345 | 345 |
346 UserScriptLoader::UserScriptLoader(Profile* profile, | 346 UserScriptLoader::UserScriptLoader(Profile* profile, |
347 const ExtensionId& owner_extension_id, | 347 const ExtensionId& owner_extension_id, |
348 bool listen_for_extension_system_loaded) | 348 bool listen_for_extension_system_loaded) |
349 : user_scripts_(new UserScriptList()), | 349 : user_scripts_(new UserScriptList()), |
350 clear_scripts_(false), | |
Devlin
2014/08/21 17:14:09
probably wanna init this still. ;)
Mark Dittmer
2014/08/21 21:25:12
Done.
| |
351 extension_system_ready_(false), | 350 extension_system_ready_(false), |
352 pending_load_(false), | 351 pending_load_(false), |
353 profile_(profile), | 352 profile_(profile), |
354 owner_extension_id_(owner_extension_id), | 353 owner_extension_id_(owner_extension_id), |
355 weak_factory_(this), | 354 weak_factory_(this), |
356 extension_registry_observer_(this) { | 355 extension_registry_observer_(this) { |
357 extension_registry_observer_.Add(ExtensionRegistry::Get(profile)); | 356 extension_registry_observer_.Add(ExtensionRegistry::Get(profile)); |
358 if (listen_for_extension_system_loaded) { | 357 if (listen_for_extension_system_loaded) { |
359 ExtensionSystem::Get(profile_)->ready().Post( | 358 ExtensionSystem::Get(profile_)->ready().Post( |
360 FROM_HERE, | 359 FROM_HERE, |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
563 base::ProcessHandle handle = process->GetHandle(); | 562 base::ProcessHandle handle = process->GetHandle(); |
564 if (!handle) | 563 if (!handle) |
565 return; | 564 return; |
566 | 565 |
567 base::SharedMemoryHandle handle_for_process; | 566 base::SharedMemoryHandle handle_for_process; |
568 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) | 567 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) |
569 return; // This can legitimately fail if the renderer asserts at startup. | 568 return; // This can legitimately fail if the renderer asserts at startup. |
570 | 569 |
571 if (base::SharedMemory::IsHandleValid(handle_for_process)) { | 570 if (base::SharedMemory::IsHandleValid(handle_for_process)) { |
572 process->Send(new ExtensionMsg_UpdateUserScripts( | 571 process->Send(new ExtensionMsg_UpdateUserScripts( |
573 handle_for_process, "" /* owner */, changed_extensions)); | 572 handle_for_process, owner_extension_id_, changed_extensions)); |
574 } | 573 } |
575 } | 574 } |
576 | 575 |
577 void UserScriptLoader::ExpandChangedExtensions( | 576 void UserScriptLoader::ExpandChangedExtensions( |
578 const std::set<UserScript>& scripts) { | 577 const std::set<UserScript>& scripts) { |
579 for (std::set<UserScript>::const_iterator it = scripts.begin(); | 578 for (std::set<UserScript>::const_iterator it = scripts.begin(); |
580 it != scripts.end(); | 579 it != scripts.end(); |
581 ++it) { | 580 ++it) { |
582 changed_extensions_.insert(it->extension_id()); | 581 changed_extensions_.insert(it->extension_id()); |
583 } | 582 } |
(...skipping 11 matching lines...) Expand all Loading... | |
595 // which leads to the above lookup failing. In this case, just continue. | 594 // which leads to the above lookup failing. In this case, just continue. |
596 if (!extension) | 595 if (!extension) |
597 continue; | 596 continue; |
598 extensions_info_[*it] = ExtensionSet::ExtensionPathAndDefaultLocale( | 597 extensions_info_[*it] = ExtensionSet::ExtensionPathAndDefaultLocale( |
599 extension->path(), LocaleInfo::GetDefaultLocale(extension)); | 598 extension->path(), LocaleInfo::GetDefaultLocale(extension)); |
600 } | 599 } |
601 } | 600 } |
602 } | 601 } |
603 | 602 |
604 } // namespace extensions | 603 } // namespace extensions |
OLD | NEW |