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

Unified Diff: mojo/shell/public/cpp/lib/connection_impl.cc

Issue 1781913003: Capability Classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@45class
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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/public/cpp/lib/connection_impl.cc
diff --git a/mojo/shell/public/cpp/lib/connection_impl.cc b/mojo/shell/public/cpp/lib/connection_impl.cc
index d3585e7061867b6e7ff7043de7db5e37c7744e10..5cfed524687d694fee4687c3351c98c0867f7d13 100644
--- a/mojo/shell/public/cpp/lib/connection_impl.cc
+++ b/mojo/shell/public/cpp/lib/connection_impl.cc
@@ -25,7 +25,7 @@ ConnectionImpl::ConnectionImpl(
uint32_t remote_id,
shell::mojom::InterfaceProviderPtr remote_interfaces,
shell::mojom::InterfaceProviderRequest local_interfaces,
- const std::set<std::string>& allowed_interfaces,
+ const CapabilityRequest& capability_request,
State initial_state)
: connection_name_(connection_name),
remote_(remote),
@@ -33,9 +33,9 @@ ConnectionImpl::ConnectionImpl(
state_(initial_state),
local_registry_(std::move(local_interfaces), this),
remote_interfaces_(std::move(remote_interfaces)),
- allowed_interfaces_(allowed_interfaces),
- allow_all_interfaces_(allowed_interfaces_.size() == 1 &&
- allowed_interfaces_.count("*") == 1),
+ capability_request_(capability_request),
+ allow_all_interfaces_(capability_request.interfaces.size() == 1 &&
+ capability_request.interfaces.count("*") == 1),
weak_factory_(this) {}
ConnectionImpl::ConnectionImpl()
@@ -53,6 +53,10 @@ shell::mojom::Connector::ConnectCallback ConnectionImpl::GetConnectCallback() {
////////////////////////////////////////////////////////////////////////////////
// ConnectionImpl, Connection implementation:
+bool ConnectionImpl::HasCapabilityClass(const std::string& class_name) const {
+ return capability_request_.classes.count(class_name) > 0;
+}
+
const std::string& ConnectionImpl::GetConnectionName() {
return connection_name_;
}
@@ -85,7 +89,8 @@ void ConnectionImpl::AddConnectionCompletedClosure(const Closure& callback) {
}
bool ConnectionImpl::AllowsInterface(const std::string& interface_name) const {
- return allow_all_interfaces_ || allowed_interfaces_.count(interface_name);
+ return allow_all_interfaces_ ||
+ capability_request_.interfaces.count(interface_name);
}
shell::mojom::InterfaceProvider* ConnectionImpl::GetRemoteInterfaces() {
« 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