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

Side by Side Diff: services/navigation/navigation.cc

Issue 2850743004: Replace ServiceInfo with BindSourceInfo. (Closed)
Patch Set: . Created 3 years, 7 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 | « services/navigation/navigation.h ('k') | services/preferences/pref_service_factory_unittest.cc » ('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 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 #include "services/navigation/navigation.h" 5 #include "services/navigation/navigation.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 27 matching lines...) Expand all
38 Navigation::Navigation() 38 Navigation::Navigation()
39 : view_task_runner_(base::ThreadTaskRunnerHandle::Get()), 39 : view_task_runner_(base::ThreadTaskRunnerHandle::Get()),
40 ref_factory_(base::MessageLoop::QuitWhenIdleClosure()) { 40 ref_factory_(base::MessageLoop::QuitWhenIdleClosure()) {
41 bindings_.set_connection_error_handler( 41 bindings_.set_connection_error_handler(
42 base::Bind(&Navigation::ViewFactoryLost, base::Unretained(this))); 42 base::Bind(&Navigation::ViewFactoryLost, base::Unretained(this)));
43 registry_.AddInterface<mojom::ViewFactory>(this); 43 registry_.AddInterface<mojom::ViewFactory>(this);
44 } 44 }
45 Navigation::~Navigation() {} 45 Navigation::~Navigation() {}
46 46
47 void Navigation::OnBindInterface( 47 void Navigation::OnBindInterface(
48 const service_manager::ServiceInfo& source_info, 48 const service_manager::BindSourceInfo& source_info,
49 const std::string& interface_name, 49 const std::string& interface_name,
50 mojo::ScopedMessagePipeHandle interface_pipe) { 50 mojo::ScopedMessagePipeHandle interface_pipe) {
51 std::string remote_user_id = source_info.identity.user_id(); 51 std::string remote_user_id = source_info.identity.user_id();
52 if (!client_user_id_.empty() && client_user_id_ != remote_user_id) { 52 if (!client_user_id_.empty() && client_user_id_ != remote_user_id) {
53 LOG(ERROR) << "Must have a separate Navigation service instance for " 53 LOG(ERROR) << "Must have a separate Navigation service instance for "
54 << "different BrowserContexts."; 54 << "different BrowserContexts.";
55 return; 55 return;
56 } 56 }
57 client_user_id_ = remote_user_id; 57 client_user_id_ = remote_user_id;
58 registry_.BindInterface(source_info.identity, interface_name, 58 registry_.BindInterface(source_info.identity, interface_name,
(...skipping 17 matching lines...) Expand all
76 mojom::ViewFactoryRequest request) { 76 mojom::ViewFactoryRequest request) {
77 bindings_.AddBinding(this, std::move(request)); 77 bindings_.AddBinding(this, std::move(request));
78 refs_.insert(ref_factory_.CreateRef()); 78 refs_.insert(ref_factory_.CreateRef());
79 } 79 }
80 80
81 void Navigation::ViewFactoryLost() { 81 void Navigation::ViewFactoryLost() {
82 refs_.erase(refs_.begin()); 82 refs_.erase(refs_.begin());
83 } 83 }
84 84
85 } // navigation 85 } // navigation
OLDNEW
« 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