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

Unified Diff: services/navigation/navigation.cc

Issue 2795883002: Eliminate OnConnect usage (Closed)
Patch Set: . Created 3 years, 8 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 | « services/navigation/navigation.h ('k') | services/preferences/pref_service_factory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/navigation/navigation.cc
diff --git a/services/navigation/navigation.cc b/services/navigation/navigation.cc
index 5f929cd5a08729a5c0ab7f1ab746cd25d584199d..0e923099340400565e85b45b769dfda2c945618c 100644
--- a/services/navigation/navigation.cc
+++ b/services/navigation/navigation.cc
@@ -38,26 +38,26 @@ std::unique_ptr<service_manager::Service> CreateNavigationService() {
Navigation::Navigation()
: view_task_runner_(base::ThreadTaskRunnerHandle::Get()),
- ref_factory_(base::MessageLoop::QuitWhenIdleClosure()),
- weak_factory_(this) {
+ ref_factory_(base::MessageLoop::QuitWhenIdleClosure()) {
bindings_.set_connection_error_handler(
base::Bind(&Navigation::ViewFactoryLost, base::Unretained(this)));
+ registry_.AddInterface<mojom::ViewFactory>(this);
}
Navigation::~Navigation() {}
-bool Navigation::OnConnect(const service_manager::ServiceInfo& remote_info,
- service_manager::InterfaceRegistry* registry) {
- std::string remote_user_id = remote_info.identity.user_id();
+void Navigation::OnBindInterface(
+ const service_manager::ServiceInfo& source_info,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle interface_pipe) {
+ std::string remote_user_id = source_info.identity.user_id();
if (!client_user_id_.empty() && client_user_id_ != remote_user_id) {
LOG(ERROR) << "Must have a separate Navigation service instance for "
<< "different BrowserContexts.";
- return false;
+ return;
}
client_user_id_ = remote_user_id;
-
- registry->AddInterface(
- base::Bind(&Navigation::CreateViewFactory, weak_factory_.GetWeakPtr()));
- return true;
+ registry_.BindInterface(source_info.identity, interface_name,
+ std::move(interface_pipe));
}
void Navigation::CreateView(mojom::ViewClientPtr client,
@@ -73,7 +73,8 @@ void Navigation::CreateView(mojom::ViewClientPtr client,
base::Passed(&context_ref)));
}
-void Navigation::CreateViewFactory(mojom::ViewFactoryRequest request) {
+void Navigation::Create(const service_manager::Identity& remote_identity,
+ mojom::ViewFactoryRequest request) {
bindings_.AddBinding(this, std::move(request));
refs_.insert(ref_factory_.CreateRef());
}
« no previous file with comments | « services/navigation/navigation.h ('k') | services/preferences/pref_service_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698