OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 // Broker RPC Client. |
| 6 |
| 7 #ifndef CEEE_IE_BROKER_BROKER_RPC_CLIENT_H_ |
| 8 #define CEEE_IE_BROKER_BROKER_RPC_CLIENT_H_ |
| 9 |
| 10 #include <wtypes.h> |
| 11 #include "base/basictypes.h" |
| 12 |
| 13 // Class provides comunication with BrokerRpcServer. |
| 14 class BrokerRpcClient { |
| 15 public: |
| 16 BrokerRpcClient(); |
| 17 ~BrokerRpcClient(); |
| 18 |
| 19 // Initialize connection with server. |
| 20 bool Connect(); |
| 21 |
| 22 // Relese connection with server |
| 23 void Disconnect(); |
| 24 |
| 25 // Returns true if object ready for remote calls. |
| 26 bool is_connected() const { |
| 27 return context_ != NULL && binding_handle_ != NULL; |
| 28 } |
| 29 |
| 30 // @name Remote calls. |
| 31 // @{ |
| 32 // Calls FireEvent on server side. |
| 33 bool FireEvent(BSTR event_name, BSTR event_args); |
| 34 // @} |
| 35 |
| 36 private: |
| 37 void LockContext(); |
| 38 void ReleaseContext(); |
| 39 |
| 40 RPC_BINDING_HANDLE binding_handle_; |
| 41 // Context handle. It is required to make RPC server know number of active |
| 42 // clients. |
| 43 void* context_; |
| 44 DISALLOW_COPY_AND_ASSIGN(BrokerRpcClient); |
| 45 }; |
| 46 |
| 47 #endif // CEEE_IE_BROKER_BROKER_RPC_CLIENT_H_ |
OLD | NEW |