Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: components/copresence/rpc/rpc_handler.cc

Issue 865483005: Creating the audio_modem component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fixes Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 13
14 // TODO(ckehoe): time.h includes windows.h, which #defines DeviceCapabilities 14 // TODO(ckehoe): time.h includes windows.h, which #defines DeviceCapabilities
15 // to DeviceCapabilitiesW. This breaks the pb.h headers below. For now, 15 // to DeviceCapabilitiesW. This breaks the pb.h headers below. For now,
16 // we fix this with an #undef. 16 // we fix this with an #undef.
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #if defined(OS_WIN) 18 #if defined(OS_WIN)
19 #undef DeviceCapabilities 19 #undef DeviceCapabilities
20 #endif 20 #endif
21 21
22 #include "components/audio_modem/public/audio_modem_types.h"
22 #include "components/copresence/copresence_state_impl.h" 23 #include "components/copresence/copresence_state_impl.h"
23 #include "components/copresence/copresence_switches.h" 24 #include "components/copresence/copresence_switches.h"
24 #include "components/copresence/handlers/directive_handler.h" 25 #include "components/copresence/handlers/directive_handler.h"
25 #include "components/copresence/handlers/gcm_handler.h" 26 #include "components/copresence/handlers/gcm_handler.h"
26 #include "components/copresence/proto/codes.pb.h" 27 #include "components/copresence/proto/codes.pb.h"
27 #include "components/copresence/proto/data.pb.h" 28 #include "components/copresence/proto/data.pb.h"
28 #include "components/copresence/proto/rpcs.pb.h" 29 #include "components/copresence/proto/rpcs.pb.h"
29 #include "components/copresence/public/copresence_constants.h" 30 #include "components/copresence/public/copresence_constants.h"
30 #include "components/copresence/public/copresence_delegate.h" 31 #include "components/copresence/public/copresence_delegate.h"
31 #include "components/copresence/rpc/http_post.h" 32 #include "components/copresence/rpc/http_post.h"
32 #include "net/http/http_status_code.h" 33 #include "net/http/http_status_code.h"
33 34
34 using google::protobuf::MessageLite; 35 using google::protobuf::MessageLite;
35 36
37 using audio_modem::AUDIBLE;
38 using audio_modem::AudioToken;
39 using audio_modem::INAUDIBLE;
40
36 // TODO(ckehoe): Return error messages for bad requests. 41 // TODO(ckehoe): Return error messages for bad requests.
37 42
38 namespace copresence { 43 namespace copresence {
39 44
40 const char RpcHandler::kReportRequestRpcName[] = "report"; 45 const char RpcHandler::kReportRequestRpcName[] = "report";
41 46
42 namespace { 47 namespace {
43 48
44 const int kTokenLoggingSuffix = 5; 49 const int kTokenLoggingSuffix = 5;
45 const int kInvalidTokenExpiryTimeMs = 10 * 60 * 1000; // 10 minutes. 50 const int kInvalidTokenExpiryTimeMs = 10 * 60 * 1000; // 10 minutes.
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 api_key, 636 api_key,
632 auth_token, 637 auth_token,
633 command_line->GetSwitchValueASCII(switches::kCopresenceTracingToken), 638 command_line->GetSwitchValueASCII(switches::kCopresenceTracingToken),
634 *request_proto); 639 *request_proto);
635 640
636 http_post->Start(base::Bind(callback, http_post)); 641 http_post->Start(base::Bind(callback, http_post));
637 pending_posts_.insert(http_post); 642 pending_posts_.insert(http_post);
638 } 643 }
639 644
640 } // namespace copresence 645 } // namespace copresence
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698