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 "components/copresence/rpc/rpc_handler.h" | 5 #include "components/copresence/rpc/rpc_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 response_handler); | 615 response_handler); |
616 } | 616 } |
617 | 617 |
618 void RpcHandler::SendHttpPost(net::URLRequestContextGetter* url_context_getter, | 618 void RpcHandler::SendHttpPost(net::URLRequestContextGetter* url_context_getter, |
619 const std::string& rpc_name, | 619 const std::string& rpc_name, |
620 const std::string& api_key, | 620 const std::string& api_key, |
621 const std::string& auth_token, | 621 const std::string& auth_token, |
622 scoped_ptr<MessageLite> request_proto, | 622 scoped_ptr<MessageLite> request_proto, |
623 const PostCleanupCallback& callback) { | 623 const PostCleanupCallback& callback) { |
624 // Create the base URL to call. | 624 // Create the base URL to call. |
625 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 625 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
626 const std::string copresence_server_host = | 626 const std::string copresence_server_host = |
627 command_line->HasSwitch(switches::kCopresenceServer) ? | 627 command_line->HasSwitch(switches::kCopresenceServer) ? |
628 command_line->GetSwitchValueASCII(switches::kCopresenceServer) : | 628 command_line->GetSwitchValueASCII(switches::kCopresenceServer) : |
629 kDefaultCopresenceServer; | 629 kDefaultCopresenceServer; |
630 | 630 |
631 // Create the request and keep a pointer until it completes. | 631 // Create the request and keep a pointer until it completes. |
632 HttpPost* http_post = new HttpPost( | 632 HttpPost* http_post = new HttpPost( |
633 url_context_getter, | 633 url_context_getter, |
634 copresence_server_host, | 634 copresence_server_host, |
635 rpc_name, | 635 rpc_name, |
636 api_key, | 636 api_key, |
637 auth_token, | 637 auth_token, |
638 command_line->GetSwitchValueASCII(switches::kCopresenceTracingToken), | 638 command_line->GetSwitchValueASCII(switches::kCopresenceTracingToken), |
639 *request_proto); | 639 *request_proto); |
640 | 640 |
641 http_post->Start(base::Bind(callback, http_post)); | 641 http_post->Start(base::Bind(callback, http_post)); |
642 pending_posts_.insert(http_post); | 642 pending_posts_.insert(http_post); |
643 } | 643 } |
644 | 644 |
645 } // namespace copresence | 645 } // namespace copresence |
OLD | NEW |