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/interface/copresence_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(CopresenceDelegate* delegate, SuccessCallback init_done_callback); |
| 31 |
| 32 virtual ~RpcHandler(); |
| 33 |
| 34 // Send a report request |
| 35 void SendReportRequest(scoped_ptr<copresence::ReportRequest> request); |
| 36 void SendReportRequest(scoped_ptr<copresence::ReportRequest> request, |
| 37 const std::string& app_id, |
| 38 const StatusCallback& callback); |
| 39 |
| 40 // Report a set of tokens to the server for a given medium. |
| 41 void ReportTokens(copresence::TokenMedium medium, |
| 42 const std::vector<std::string>& tokens); |
| 43 |
| 44 // Create the directive handler and connect it to the whispernet client. |
| 45 void ConnectToWhispernet(WhispernetClient* whispernet_client); |
| 46 |
| 47 // Disconnect the directive handler from the whispernet client. |
| 48 void DisconnectFromWhispernet(); |
| 49 |
| 50 private: |
| 51 DISALLOW_COPY_AND_ASSIGN(RpcHandler); |
| 52 }; |
| 53 |
| 54 } // namespace copresence |
| 55 |
| 56 #endif // COMPONENTS_COPRESENCE_RPC_RPC_HANDLER_H_ |
OLD | NEW |