| 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 "extensions/renderer/user_script_set_manager.h" | 5 #include "extensions/renderer/user_script_set_manager.h" |
| 6 | 6 |
| 7 #include "content/public/renderer/render_thread.h" | 7 #include "content/public/renderer/render_thread.h" |
| 8 #include "extensions/common/extension_messages.h" | 8 #include "extensions/common/extension_messages.h" |
| 9 #include "extensions/renderer/dispatcher.h" | 9 #include "extensions/renderer/dispatcher.h" |
| 10 #include "extensions/renderer/user_script_set.h" | 10 #include "extensions/renderer/user_script_set.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 scripts = new UserScriptSet(extensions_); | 100 scripts = new UserScriptSet(extensions_); |
| 101 programmatic_scripts_[extension_id] = make_linked_ptr(scripts); | 101 programmatic_scripts_[extension_id] = make_linked_ptr(scripts); |
| 102 } else { | 102 } else { |
| 103 scripts = programmatic_scripts_[extension_id].get(); | 103 scripts = programmatic_scripts_[extension_id].get(); |
| 104 } | 104 } |
| 105 } else { | 105 } else { |
| 106 scripts = &static_scripts_; | 106 scripts = &static_scripts_; |
| 107 } | 107 } |
| 108 DCHECK(scripts); | 108 DCHECK(scripts); |
| 109 | 109 |
| 110 // If no extensions are included in the set, that indicates that all | 110 if (scripts->OnUpdateUserScripts(shared_memory, changed_extensions)) { |
| 111 // extensions were updated. Add them all to the set so that observers and | |
| 112 // individual UserScriptSets don't need to know this detail. | |
| 113 const std::set<std::string>* effective_extensions = &changed_extensions; | |
| 114 std::set<std::string> all_extensions; | |
| 115 if (changed_extensions.empty()) { | |
| 116 all_extensions = extensions_->GetIDs(); | |
| 117 effective_extensions = &all_extensions; | |
| 118 } | |
| 119 | |
| 120 if (scripts->UpdateUserScripts(shared_memory, *effective_extensions)) { | |
| 121 FOR_EACH_OBSERVER( | 111 FOR_EACH_OBSERVER( |
| 122 Observer, | 112 Observer, |
| 123 observers_, | 113 observers_, |
| 124 OnUserScriptsUpdated(*effective_extensions, scripts->scripts())); | 114 OnUserScriptsUpdated(changed_extensions, scripts->scripts())); |
| 125 } | 115 } |
| 126 } | 116 } |
| 127 | 117 |
| 128 } // namespace extensions | 118 } // namespace extensions |
| OLD | NEW |