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

Side by Side Diff: mojo/shell/public/cpp/lib/connection_impl.cc

Issue 1770533002: Change userid from a uint32_t to a string guid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@33connector
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
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 #include "mojo/shell/public/cpp/lib/connection_impl.h" 5 #include "mojo/shell/public/cpp/lib/connection_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "mojo/shell/public/cpp/connection.h" 13 #include "mojo/shell/public/cpp/connection.h"
14 #include "mojo/shell/public/cpp/interface_binder.h" 14 #include "mojo/shell/public/cpp/interface_binder.h"
15 15
16 namespace mojo { 16 namespace mojo {
17 namespace internal { 17 namespace internal {
18 18
19 //////////////////////////////////////////////////////////////////////////////// 19 ////////////////////////////////////////////////////////////////////////////////
20 // ConnectionImpl, public: 20 // ConnectionImpl, public:
21 21
22 ConnectionImpl::ConnectionImpl( 22 ConnectionImpl::ConnectionImpl(
23 const std::string& connection_name, 23 const std::string& connection_name,
24 const std::string& remote_name, 24 const std::string& remote_name,
25 uint32_t remote_id, 25 uint32_t remote_id,
26 uint32_t remote_user_id, 26 const std::string& remote_user_id,
27 shell::mojom::InterfaceProviderPtr remote_interfaces, 27 shell::mojom::InterfaceProviderPtr remote_interfaces,
28 shell::mojom::InterfaceProviderRequest local_interfaces, 28 shell::mojom::InterfaceProviderRequest local_interfaces,
29 const std::set<std::string>& allowed_interfaces) 29 const std::set<std::string>& allowed_interfaces)
30 : connection_name_(connection_name), 30 : connection_name_(connection_name),
31 remote_name_(remote_name), 31 remote_name_(remote_name),
32 remote_id_(remote_id), 32 remote_id_(remote_id),
33 remote_ids_valid_( 33 remote_ids_valid_(
34 remote_id != shell::mojom::Connector::kInvalidApplicationID), 34 remote_id != shell::mojom::Connector::kInvalidApplicationID),
35 remote_user_id_(remote_user_id), 35 remote_user_id_(remote_user_id),
36 local_registry_(std::move(local_interfaces), this), 36 local_registry_(std::move(local_interfaces), this),
(...skipping 21 matching lines...) Expand all
58 // ConnectionImpl, Connection implementation: 58 // ConnectionImpl, Connection implementation:
59 59
60 const std::string& ConnectionImpl::GetConnectionName() { 60 const std::string& ConnectionImpl::GetConnectionName() {
61 return connection_name_; 61 return connection_name_;
62 } 62 }
63 63
64 const std::string& ConnectionImpl::GetRemoteApplicationName() { 64 const std::string& ConnectionImpl::GetRemoteApplicationName() {
65 return remote_name_; 65 return remote_name_;
66 } 66 }
67 67
68 uint32_t ConnectionImpl::GetRemoteUserID() const { 68 const std::string& ConnectionImpl::GetRemoteUserID() const {
69 return remote_user_id_; 69 return remote_user_id_;
70 } 70 }
71 71
72 void ConnectionImpl::SetRemoteInterfaceProviderConnectionErrorHandler( 72 void ConnectionImpl::SetRemoteInterfaceProviderConnectionErrorHandler(
73 const Closure& handler) { 73 const Closure& handler) {
74 remote_interfaces_.set_connection_error_handler(handler); 74 remote_interfaces_.set_connection_error_handler(handler);
75 } 75 }
76 76
77 bool ConnectionImpl::GetRemoteApplicationID(uint32_t* remote_id) const { 77 bool ConnectionImpl::GetRemoteApplicationID(uint32_t* remote_id) const {
78 if (!remote_ids_valid_) 78 if (!remote_ids_valid_)
(...skipping 23 matching lines...) Expand all
102 return &local_registry_; 102 return &local_registry_;
103 } 103 }
104 104
105 base::WeakPtr<Connection> ConnectionImpl::GetWeakPtr() { 105 base::WeakPtr<Connection> ConnectionImpl::GetWeakPtr() {
106 return weak_factory_.GetWeakPtr(); 106 return weak_factory_.GetWeakPtr();
107 } 107 }
108 108
109 //////////////////////////////////////////////////////////////////////////////// 109 ////////////////////////////////////////////////////////////////////////////////
110 // ConnectionImpl, private: 110 // ConnectionImpl, private:
111 111
112 void ConnectionImpl::OnGotInstanceID(uint32_t target_application_id, 112 void ConnectionImpl::OnGotInstanceID(const std::string& target_user_id,
113 uint32_t target_user_id) { 113 uint32_t target_application_id) {
114 DCHECK(!remote_ids_valid_); 114 DCHECK(!remote_ids_valid_);
115 remote_ids_valid_ = true; 115 remote_ids_valid_ = true;
116 116
117 remote_id_ = target_application_id; 117 remote_id_ = target_application_id;
118 remote_user_id_= target_user_id; 118 remote_user_id_= target_user_id;
119 std::vector<Closure> callbacks; 119 std::vector<Closure> callbacks;
120 callbacks.swap(remote_id_callbacks_); 120 callbacks.swap(remote_id_callbacks_);
121 for (auto callback : callbacks) 121 for (auto callback : callbacks)
122 callback.Run(); 122 callback.Run();
123 } 123 }
124 124
125 } // namespace internal 125 } // namespace internal
126 } // namespace mojo 126 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/lib/connection_impl.h ('k') | mojo/shell/public/cpp/lib/connector_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698