| 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/browser/script_executor.h" | 5 #include "extensions/browser/script_executor.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // We never finished the root frame injection. | 161 // We never finished the root frame injection. |
| 162 root_frame_error_ = | 162 root_frame_error_ = |
| 163 root_is_main_frame_ ? kRendererDestroyed : kFrameRemoved; | 163 root_is_main_frame_ ? kRendererDestroyed : kFrameRemoved; |
| 164 results_.Clear(); | 164 results_.Clear(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 if (script_observers_.get() && root_frame_error_.empty() && | 167 if (script_observers_.get() && root_frame_error_.empty() && |
| 168 host_id_.type() == HostID::EXTENSIONS) { | 168 host_id_.type() == HostID::EXTENSIONS) { |
| 169 ScriptExecutionObserver::ExecutingScriptsMap id_map; | 169 ScriptExecutionObserver::ExecutingScriptsMap id_map; |
| 170 id_map[host_id_.id()] = std::set<std::string>(); | 170 id_map[host_id_.id()] = std::set<std::string>(); |
| 171 FOR_EACH_OBSERVER( | 171 for (auto& observer : *script_observers_) |
| 172 ScriptExecutionObserver, *script_observers_, | 172 observer.OnScriptsExecuted(web_contents(), id_map, root_frame_url_); |
| 173 OnScriptsExecuted(web_contents(), id_map, root_frame_url_)); | |
| 174 } | 173 } |
| 175 | 174 |
| 176 if (!callback_.is_null()) | 175 if (!callback_.is_null()) |
| 177 callback_.Run(root_frame_error_, root_frame_url_, results_); | 176 callback_.Run(root_frame_error_, root_frame_url_, results_); |
| 178 delete this; | 177 delete this; |
| 179 } | 178 } |
| 180 | 179 |
| 181 base::WeakPtr<base::ObserverList<ScriptExecutionObserver>> script_observers_; | 180 base::WeakPtr<base::ObserverList<ScriptExecutionObserver>> script_observers_; |
| 182 | 181 |
| 183 // The id of the host (the extension or the webui) doing the injection. | 182 // The id of the host (the extension or the webui) doing the injection. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 params.file_url = file_url; | 268 params.file_url = file_url; |
| 270 params.wants_result = (result_type == JSON_SERIALIZED_RESULT); | 269 params.wants_result = (result_type == JSON_SERIALIZED_RESULT); |
| 271 params.user_gesture = user_gesture; | 270 params.user_gesture = user_gesture; |
| 272 | 271 |
| 273 // Handler handles IPCs and deletes itself on completion. | 272 // Handler handles IPCs and deletes itself on completion. |
| 274 new Handler(script_observers_, web_contents_, params, frame_scope, frame_id, | 273 new Handler(script_observers_, web_contents_, params, frame_scope, frame_id, |
| 275 callback); | 274 callback); |
| 276 } | 275 } |
| 277 | 276 |
| 278 } // namespace extensions | 277 } // namespace extensions |
| OLD | NEW |