OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_ | 5 #ifndef MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_ |
6 #define MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_ | 6 #define MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_ |
7 | 7 |
8 #include "mojo/shell/public/cpp/connection.h" | 8 #include "mojo/shell/public/cpp/connection.h" |
9 #include "mojo/shell/public/interfaces/connector.mojom.h" | 9 #include "mojo/shell/public/interfaces/connector.mojom.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 class Connector { | 27 class Connector { |
28 public: | 28 public: |
29 virtual ~Connector() {} | 29 virtual ~Connector() {} |
30 | 30 |
31 class ConnectParams { | 31 class ConnectParams { |
32 public: | 32 public: |
33 explicit ConnectParams(const std::string& name); | 33 explicit ConnectParams(const std::string& name); |
34 ~ConnectParams(); | 34 ~ConnectParams(); |
35 | 35 |
36 const std::string& name() { return name_; } | 36 const std::string& name() { return name_; } |
37 void set_user_id(uint32_t user_id) { user_id_ = user_id; } | 37 void set_user_id(const std::string& user_id) { user_id_ = user_id; } |
38 uint32_t user_id() const { return user_id_; } | 38 const std::string& user_id() const { return user_id_; } |
39 | 39 |
40 private: | 40 private: |
41 std::string name_; | 41 std::string name_; |
42 uint32_t user_id_; | 42 std::string user_id_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(ConnectParams); | 44 DISALLOW_COPY_AND_ASSIGN(ConnectParams); |
45 }; | 45 }; |
46 | 46 |
47 // Requests a new connection to an application. Returns a pointer to the | 47 // Requests a new connection to an application. Returns a pointer to the |
48 // connection if the connection is permitted by this application's delegate, | 48 // connection if the connection is permitted by this application's delegate, |
49 // or nullptr otherwise. Caller takes ownership. | 49 // or nullptr otherwise. Caller takes ownership. |
50 // Once this method is called, this object is bound to the thread on which the | 50 // Once this method is called, this object is bound to the thread on which the |
51 // call took place. To pass to another thread, call Clone() and pass the | 51 // call took place. To pass to another thread, call Clone() and pass the |
52 // result. | 52 // result. |
(...skipping 17 matching lines...) Expand all Loading... |
70 | 70 |
71 // Creates a new instance of this class which may be passed to another thread. | 71 // Creates a new instance of this class which may be passed to another thread. |
72 // The returned object may be passed multiple times until Connect() is called, | 72 // The returned object may be passed multiple times until Connect() is called, |
73 // at which point this method must be called again to pass again. | 73 // at which point this method must be called again to pass again. |
74 virtual scoped_ptr<Connector> Clone() = 0; | 74 virtual scoped_ptr<Connector> Clone() = 0; |
75 }; | 75 }; |
76 | 76 |
77 } // namespace mojo | 77 } // namespace mojo |
78 | 78 |
79 #endif // MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_ | 79 #endif // MOJO_SHELL_PUBLIC_CPP_CONNECTOR_H_ |
OLD | NEW |