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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 bool is_root_frame = root_rfh_ == render_frame_host; | 136 bool is_root_frame = root_rfh_ == render_frame_host; |
137 | 137 |
138 // Set the result, if there is one. | 138 // Set the result, if there is one. |
139 const base::Value* script_value = nullptr; | 139 const base::Value* script_value = nullptr; |
140 if (result_list.Get(0u, &script_value)) { | 140 if (result_list.Get(0u, &script_value)) { |
141 // If this is the main result, we put it at index 0. Otherwise, we just | 141 // If this is the main result, we put it at index 0. Otherwise, we just |
142 // append it at the end. | 142 // append it at the end. |
143 if (is_root_frame && !results_.empty()) | 143 if (is_root_frame && !results_.empty()) |
144 CHECK(results_.Insert(0u, script_value->DeepCopy())); | 144 CHECK(results_.Insert(0u, script_value->DeepCopy())); |
145 else | 145 else |
146 results_.Append(script_value->DeepCopy()); | 146 results_.Append(script_value->CreateDeepCopy()); |
147 } | 147 } |
148 | 148 |
149 if (is_root_frame) { // Only use the root frame's error and url. | 149 if (is_root_frame) { // Only use the root frame's error and url. |
150 root_frame_error_ = error; | 150 root_frame_error_ = error; |
151 root_frame_url_ = on_url; | 151 root_frame_url_ = on_url; |
152 } | 152 } |
153 | 153 |
154 // Wait until the final request finishes before reporting back. | 154 // Wait until the final request finishes before reporting back. |
155 if (pending_render_frames_.empty()) | 155 if (pending_render_frames_.empty()) |
156 Finish(); | 156 Finish(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 params.file_url = file_url; | 269 params.file_url = file_url; |
270 params.wants_result = (result_type == JSON_SERIALIZED_RESULT); | 270 params.wants_result = (result_type == JSON_SERIALIZED_RESULT); |
271 params.user_gesture = user_gesture; | 271 params.user_gesture = user_gesture; |
272 | 272 |
273 // Handler handles IPCs and deletes itself on completion. | 273 // Handler handles IPCs and deletes itself on completion. |
274 new Handler(script_observers_, web_contents_, params, frame_scope, frame_id, | 274 new Handler(script_observers_, web_contents_, params, frame_scope, frame_id, |
275 callback); | 275 callback); |
276 } | 276 } |
277 | 277 |
278 } // namespace extensions | 278 } // namespace extensions |
OLD | NEW |