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