OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_function.h" | 5 #include "chrome/browser/extensions/extension_function.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 9 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } | 180 } |
181 | 181 |
182 void IOThreadExtensionFunction::SendResponse(bool success) { | 182 void IOThreadExtensionFunction::SendResponse(bool success) { |
183 if (!ipc_sender()) | 183 if (!ipc_sender()) |
184 return; | 184 return; |
185 | 185 |
186 SendResponseImpl(ipc_sender()->peer_handle(), | 186 SendResponseImpl(ipc_sender()->peer_handle(), |
187 ipc_sender(), routing_id_, success); | 187 ipc_sender(), routing_id_, success); |
188 } | 188 } |
189 | 189 |
190 AsyncExtensionFunction::AsyncExtensionFunction() { | 190 AsyncExtensionFunction::AsyncExtensionFunction() : delegate_(NULL) { |
| 191 } |
| 192 |
| 193 void AsyncExtensionFunction::SendResponse(bool success) { |
| 194 if (delegate_) |
| 195 delegate_->OnSendResponse(this, success); |
| 196 else |
| 197 UIThreadExtensionFunction::SendResponse(success); |
191 } | 198 } |
192 | 199 |
193 AsyncExtensionFunction::~AsyncExtensionFunction() { | 200 AsyncExtensionFunction::~AsyncExtensionFunction() { |
194 } | 201 } |
195 | 202 |
196 SyncExtensionFunction::SyncExtensionFunction() { | 203 SyncExtensionFunction::SyncExtensionFunction() { |
197 } | 204 } |
198 | 205 |
199 SyncExtensionFunction::~SyncExtensionFunction() { | 206 SyncExtensionFunction::~SyncExtensionFunction() { |
200 } | 207 } |
201 | 208 |
202 void SyncExtensionFunction::Run() { | 209 void SyncExtensionFunction::Run() { |
203 SendResponse(RunImpl()); | 210 SendResponse(RunImpl()); |
204 } | 211 } |
205 | 212 |
206 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { | 213 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { |
207 } | 214 } |
208 | 215 |
209 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { | 216 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { |
210 } | 217 } |
211 | 218 |
212 void SyncIOThreadExtensionFunction::Run() { | 219 void SyncIOThreadExtensionFunction::Run() { |
213 SendResponse(RunImpl()); | 220 SendResponse(RunImpl()); |
214 } | 221 } |
OLD | NEW |