Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / components / nacl / renderer / plugin / srpc_client.h
blob7bd4a04f472fbe0b49bd4006b7a23ea757f51fac
1 /*
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
7 // A representation of an SRPC connection. These can be either to the
8 // service runtime or to untrusted NaCl threads.
10 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_SRPC_CLIENT_H_
11 #define COMPONENTS_NACL_RENDERER_PLUGIN_SRPC_CLIENT_H_
13 #include <map>
14 #include <string>
16 #include "components/nacl/renderer/plugin/utility.h"
17 #include "native_client/src/include/nacl_macros.h"
18 #include "native_client/src/shared/srpc/nacl_srpc.h"
20 namespace nacl {
21 class DescWrapper;
22 } // namespace nacl
24 namespace plugin {
26 class MethodInfo;
27 class SrpcParams;
29 // SrpcClient represents an SRPC connection to a client.
30 class SrpcClient {
31 public:
32 // Factory method for creating SrpcClients.
33 static SrpcClient* New(nacl::DescWrapper* wrapper);
35 // Init is passed a DescWrapper. The SrpcClient performs service
36 // discovery and provides the interface for future rpcs.
37 bool Init(nacl::DescWrapper* socket);
39 // The destructor closes the connection to sel_ldr.
40 ~SrpcClient();
42 // Test whether the SRPC service has a given method.
43 bool HasMethod(const std::string& method_name);
44 // Invoke an SRPC method.
45 bool Invoke(const std::string& method_name, SrpcParams* params);
46 // Get the error status from that last method invocation
47 NaClSrpcError GetLastError() const { return last_error_; }
48 bool InitParams(const std::string& method_name, SrpcParams* params);
50 private:
51 NACL_DISALLOW_COPY_AND_ASSIGN(SrpcClient);
52 SrpcClient();
53 void GetMethods();
54 typedef std::map<std::string, MethodInfo*> Methods;
55 Methods methods_;
56 NaClSrpcChannel srpc_channel_;
57 bool srpc_channel_initialised_;
58 NaClSrpcError last_error_;
61 } // namespace plugin
63 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_SRPC_CLIENT_H_