OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_COPRESENCE_RPC_RPC_HANDLER_H_ |
| 6 #define COMPONENTS_COPRESENCE_RPC_RPC_HANDLER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "components/copresence/public/copresence_client_delegate.h" |
| 15 |
| 16 namespace copresence { |
| 17 |
| 18 class ReportRequest; |
| 19 class WhispernetClient; |
| 20 |
| 21 // This class currently handles all communication with the copresence server. |
| 22 // NOTE: This class is a stub. |
| 23 class RpcHandler { |
| 24 public: |
| 25 // A callback to indicate whether handler initialization succeeded. |
| 26 typedef base::Callback<void(bool)> SuccessCallback; |
| 27 |
| 28 // Constructor. May call the server to register a device, |
| 29 // so completion status is indicated by the SuccessCallback. |
| 30 RpcHandler(CopresenceClientDelegate* delegate, |
| 31 SuccessCallback init_done_callback); |
| 32 |
| 33 virtual ~RpcHandler(); |
| 34 |
| 35 // Send a report request |
| 36 void SendReportRequest(scoped_ptr<copresence::ReportRequest> request); |
| 37 void SendReportRequest(scoped_ptr<copresence::ReportRequest> request, |
| 38 const std::string& app_id, |
| 39 const StatusCallback& callback); |
| 40 |
| 41 // Report a set of tokens to the server for a given medium. |
| 42 void ReportTokens(copresence::TokenMedium medium, |
| 43 const std::vector<std::string>& tokens); |
| 44 |
| 45 // Create the directive handler and connect it to the whispernet client. |
| 46 void ConnectToWhispernet(WhispernetClient* whispernet_client); |
| 47 |
| 48 // Disconnect the directive handler from the whispernet client. |
| 49 void DisconnectFromWhispernet(); |
| 50 |
| 51 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(RpcHandler); |
| 53 }; |
| 54 |
| 55 } // namespace copresence |
| 56 |
| 57 #endif // COMPONENTS_COPRESENCE_RPC_RPC_HANDLER_H_ |
OLD | NEW |