| 280 | } |
| 281 | |
| 282 | void |
| 283 | APIServer::Client::SendInvoke( |
| 284 | const API::MethodCallback& callback, |
| 285 | unsigned int target, |
| 286 | const std::string method, |
| 287 | scoped_ptr<base::DictionaryValue> args) |
| 288 | { |
| 289 | /* Runs on IO Thread. */ |
| 290 | unsigned int action_id = ++action_id_; |
| 291 | |
| 292 | invokes_[action_id] = callback; |
| 293 | |
| 294 | base::DictionaryValue action; |
| 295 | action.SetString("_action", "invoke"); |
| 296 | action.SetInteger("_id", action_id); |
| 297 | action.SetInteger("_target", target); |
| 298 | action.SetString("_method", method); |
| 299 | action.Set("_args", args->DeepCopy()); |
| 300 | |
| 301 | std::string payload; |
| 302 | base::JSONWriter::Write(&action, &payload); |
| 303 | payload += "\n" + std::string(kSocketBoundary) + "\n"; |
| 304 | |
| 305 | std::cout << payload; |
| 306 | std::cout.flush(); |
| 307 | } |
| 308 | |
| 309 | |
| 310 | /******************************************************************************/ |
nothing calls this directly
no outgoing calls
no test coverage detected