| 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 "components/crx_file/id_util.h" |
| 7 #include "content/public/renderer/render_thread.h" | 8 #include "content/public/renderer/render_thread.h" |
| 8 #include "extensions/common/extension_messages.h" | 9 #include "extensions/common/extension_messages.h" |
| 9 #include "extensions/renderer/dispatcher.h" | 10 #include "extensions/renderer/dispatcher.h" |
| 10 #include "extensions/renderer/user_script_set.h" | 11 #include "extensions/renderer/user_script_set.h" |
| 11 #include "ipc/ipc_message.h" | 12 #include "ipc/ipc_message.h" |
| 12 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
| 13 #include "third_party/WebKit/public/web/WebFrame.h" | 14 #include "third_party/WebKit/public/web/WebFrame.h" |
| 14 | 15 |
| 15 namespace extensions { | 16 namespace extensions { |
| 16 | 17 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 const ExtensionId& extension_id, | 77 const ExtensionId& extension_id, |
| 77 const std::set<std::string>& changed_extensions) { | 78 const std::set<std::string>& changed_extensions) { |
| 78 if (!base::SharedMemory::IsHandleValid(shared_memory)) { | 79 if (!base::SharedMemory::IsHandleValid(shared_memory)) { |
| 79 NOTREACHED() << "Bad scripts handle"; | 80 NOTREACHED() << "Bad scripts handle"; |
| 80 return; | 81 return; |
| 81 } | 82 } |
| 82 | 83 |
| 83 for (std::set<std::string>::const_iterator iter = changed_extensions.begin(); | 84 for (std::set<std::string>::const_iterator iter = changed_extensions.begin(); |
| 84 iter != changed_extensions.end(); | 85 iter != changed_extensions.end(); |
| 85 ++iter) { | 86 ++iter) { |
| 86 if (!Extension::IdIsValid(*iter)) { | 87 if (!crx_file::id_util::IdIsValid(*iter)) { |
| 87 NOTREACHED() << "Invalid extension id: " << *iter; | 88 NOTREACHED() << "Invalid extension id: " << *iter; |
| 88 return; | 89 return; |
| 89 } | 90 } |
| 90 } | 91 } |
| 91 | 92 |
| 92 UserScriptSet* scripts = NULL; | 93 UserScriptSet* scripts = NULL; |
| 93 if (!extension_id.empty()) { | 94 if (!extension_id.empty()) { |
| 94 // The expectation when there is an extensions that "owns" this shared | 95 // The expectation when there is an extensions that "owns" this shared |
| 95 // memory region is that it will list itself as the only changed extension. | 96 // memory region is that it will list itself as the only changed extension. |
| 96 CHECK(changed_extensions.size() == 1 && | 97 CHECK(changed_extensions.size() == 1 && |
| (...skipping 22 matching lines...) Expand all Loading... |
| 119 | 120 |
| 120 if (scripts->UpdateUserScripts(shared_memory, *effective_extensions)) { | 121 if (scripts->UpdateUserScripts(shared_memory, *effective_extensions)) { |
| 121 FOR_EACH_OBSERVER( | 122 FOR_EACH_OBSERVER( |
| 122 Observer, | 123 Observer, |
| 123 observers_, | 124 observers_, |
| 124 OnUserScriptsUpdated(*effective_extensions, scripts->scripts())); | 125 OnUserScriptsUpdated(*effective_extensions, scripts->scripts())); |
| 125 } | 126 } |
| 126 } | 127 } |
| 127 | 128 |
| 128 } // namespace extensions | 129 } // namespace extensions |
| OLD | NEW |