| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 | 12 |
| 13 // TODO(ckehoe): time.h includes windows.h, which #defines DeviceCapabilities | 13 // TODO(ckehoe): time.h includes windows.h, which #defines DeviceCapabilities |
| 14 // to DeviceCapabilitiesW. This breaks the pb.h headers below. For now, | 14 // to DeviceCapabilitiesW. This breaks the pb.h headers below. For now, |
| 15 // we fix this with an #undef. | 15 // we fix this with an #undef. |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 #undef DeviceCapabilities | 18 #undef DeviceCapabilities |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 #include "components/audio_modem/public/audio_modem_types.h" |
| 21 #include "components/copresence/copresence_state_impl.h" | 22 #include "components/copresence/copresence_state_impl.h" |
| 22 #include "components/copresence/copresence_switches.h" | 23 #include "components/copresence/copresence_switches.h" |
| 23 #include "components/copresence/handlers/directive_handler.h" | 24 #include "components/copresence/handlers/directive_handler.h" |
| 24 #include "components/copresence/handlers/gcm_handler.h" | 25 #include "components/copresence/handlers/gcm_handler.h" |
| 25 #include "components/copresence/proto/codes.pb.h" | 26 #include "components/copresence/proto/codes.pb.h" |
| 26 #include "components/copresence/proto/data.pb.h" | 27 #include "components/copresence/proto/data.pb.h" |
| 27 #include "components/copresence/proto/rpcs.pb.h" | 28 #include "components/copresence/proto/rpcs.pb.h" |
| 28 #include "components/copresence/public/copresence_constants.h" | 29 #include "components/copresence/public/copresence_constants.h" |
| 29 #include "components/copresence/public/copresence_delegate.h" | 30 #include "components/copresence/public/copresence_delegate.h" |
| 30 #include "components/copresence/rpc/http_post.h" | 31 #include "components/copresence/rpc/http_post.h" |
| 31 #include "net/http/http_status_code.h" | 32 #include "net/http/http_status_code.h" |
| 32 | 33 |
| 33 using google::protobuf::MessageLite; | 34 using google::protobuf::MessageLite; |
| 34 | 35 |
| 36 using audio_modem::AUDIBLE; |
| 37 using audio_modem::AudioToken; |
| 38 using audio_modem::INAUDIBLE; |
| 39 |
| 35 // TODO(ckehoe): Return error messages for bad requests. | 40 // TODO(ckehoe): Return error messages for bad requests. |
| 36 | 41 |
| 37 namespace copresence { | 42 namespace copresence { |
| 38 | 43 |
| 39 const char RpcHandler::kReportRequestRpcName[] = "report"; | 44 const char RpcHandler::kReportRequestRpcName[] = "report"; |
| 40 | 45 |
| 41 namespace { | 46 namespace { |
| 42 | 47 |
| 43 const int kTokenLoggingSuffix = 5; | 48 const int kTokenLoggingSuffix = 5; |
| 44 const int kInvalidTokenExpiryTimeMs = 10 * 60 * 1000; // 10 minutes. | 49 const int kInvalidTokenExpiryTimeMs = 10 * 60 * 1000; // 10 minutes. |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 api_key, | 631 api_key, |
| 627 auth_token, | 632 auth_token, |
| 628 command_line->GetSwitchValueASCII(switches::kCopresenceTracingToken), | 633 command_line->GetSwitchValueASCII(switches::kCopresenceTracingToken), |
| 629 *request_proto); | 634 *request_proto); |
| 630 | 635 |
| 631 http_post->Start(base::Bind(callback, http_post)); | 636 http_post->Start(base::Bind(callback, http_post)); |
| 632 pending_posts_.insert(http_post); | 637 pending_posts_.insert(http_post); |
| 633 } | 638 } |
| 634 | 639 |
| 635 } // namespace copresence | 640 } // namespace copresence |
| OLD | NEW |