Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: mojo/shell/public/cpp/connection.h

Issue 1769163002: Add a instance groups to Connect(), and introduce an Identity struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/shell/public/cpp/BUILD.gn ('k') | mojo/shell/public/cpp/connector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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_CONNECTION_H_ 5 #ifndef MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_
6 #define MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ 6 #define MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "mojo/shell/public/cpp/connect.h" 14 #include "mojo/shell/public/cpp/connect.h"
15 #include "mojo/shell/public/cpp/identity.h"
15 #include "mojo/shell/public/cpp/interface_registry.h" 16 #include "mojo/shell/public/cpp/interface_registry.h"
16 #include "mojo/shell/public/interfaces/connector.mojom.h" 17 #include "mojo/shell/public/interfaces/connector.mojom.h"
17 #include "mojo/shell/public/interfaces/interface_provider.mojom.h" 18 #include "mojo/shell/public/interfaces/interface_provider.mojom.h"
18 19
19 namespace mojo { 20 namespace mojo {
20 21
21 class InterfaceBinder; 22 class InterfaceBinder;
22 23
23 // Represents a connection to another application. An instance of this class is 24 // Represents a connection to another application. An instance of this class is
24 // returned from Shell's ConnectToApplication(), and passed to ShellClient's 25 // returned from Shell's ConnectToApplication(), and passed to ShellClient's
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 mojo::GetInterface(GetRemoteInterfaces(), ptr); 82 mojo::GetInterface(GetRemoteInterfaces(), ptr);
82 } 83 }
83 84
84 // Returns the name that was used by the source application to establish a 85 // Returns the name that was used by the source application to establish a
85 // connection to the destination application. 86 // connection to the destination application.
86 // 87 //
87 // When Connection is representing and outgoing connection, this will be the 88 // When Connection is representing and outgoing connection, this will be the
88 // same as the value returned by GetRemoveApplicationName(). 89 // same as the value returned by GetRemoveApplicationName().
89 virtual const std::string& GetConnectionName() = 0; 90 virtual const std::string& GetConnectionName() = 0;
90 91
91 // Returns the name identifying the remote application on this connection. 92 // Returns the remote identity. While the connection is in the pending state,
92 virtual const std::string& GetRemoteApplicationName() = 0; 93 // the user_id() field will be the value passed via Connect(). After the
93 94 // connection is completed, it will change to the value assigned by the shell.
94 // Returns the User ID for the remote application. Prior to the Connect() 95 // Call AddConnectionCompletedClosure() to schedule a closure to be run when
95 // callback being fired, this will return the value passed via Connect(). 96 // the resolved user id is available.
96 // After the Connect() callback (call AddRemoteIDCallback to register one) 97 virtual const Identity& GetRemoteIdentity() const = 0;
97 // this will return the actual user id the shell ran the target as.
98 virtual const std::string& GetRemoteUserID() const = 0;
99 98
100 // Register a handler to receive an error notification on the pipe to the 99 // Register a handler to receive an error notification on the pipe to the
101 // remote application's InterfaceProvider. 100 // remote application's InterfaceProvider.
102 virtual void SetConnectionLostClosure(const Closure& handler) = 0; 101 virtual void SetConnectionLostClosure(const Closure& handler) = 0;
103 102
104 // Returns the result of the connection. This function should only be called 103 // Returns the result of the connection. This function should only be called
105 // when the connection state is not pending. Call 104 // when the connection state is not pending. Call
106 // AddConnectionCompletedClosure() to schedule a closure to be run when the 105 // AddConnectionCompletedClosure() to schedule a closure to be run when the
107 // connection is processed by the shell. 106 // connection is processed by the shell.
108 virtual shell::mojom::ConnectResult GetResult() const = 0; 107 virtual shell::mojom::ConnectResult GetResult() const = 0;
(...skipping 25 matching lines...) Expand all
134 133
135 protected: 134 protected:
136 virtual InterfaceRegistry* GetLocalRegistry() = 0; 135 virtual InterfaceRegistry* GetLocalRegistry() = 0;
137 136
138 virtual base::WeakPtr<Connection> GetWeakPtr() = 0; 137 virtual base::WeakPtr<Connection> GetWeakPtr() = 0;
139 }; 138 };
140 139
141 } // namespace mojo 140 } // namespace mojo
142 141
143 #endif // MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ 142 #endif // MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/BUILD.gn ('k') | mojo/shell/public/cpp/connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698