OLD | NEW |
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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "services/navigation/view_impl.h" | 10 #include "services/navigation/view_impl.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 LOG(ERROR) << "Must have a separate Navigation service instance for " | 42 LOG(ERROR) << "Must have a separate Navigation service instance for " |
43 << "different BrowserContexts."; | 43 << "different BrowserContexts."; |
44 return false; | 44 return false; |
45 } | 45 } |
46 client_user_id_ = remote_user_id; | 46 client_user_id_ = remote_user_id; |
47 | 47 |
48 connection->AddInterface<mojom::ViewFactory>(this); | 48 connection->AddInterface<mojom::ViewFactory>(this); |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 void Navigation::Create(shell::Connection* connection, | 52 void Navigation::Create(const shell::Identity& remote_identity, |
53 mojom::ViewFactoryRequest request) { | 53 mojom::ViewFactoryRequest request) { |
54 bindings_.AddBinding(this, std::move(request)); | 54 bindings_.AddBinding(this, std::move(request)); |
55 refs_.insert(ref_factory_.CreateRef()); | 55 refs_.insert(ref_factory_.CreateRef()); |
56 } | 56 } |
57 | 57 |
58 void Navigation::CreateView(mojom::ViewClientPtr client, | 58 void Navigation::CreateView(mojom::ViewClientPtr client, |
59 mojom::ViewRequest request) { | 59 mojom::ViewRequest request) { |
60 std::unique_ptr<shell::Connector> new_connector = connector_->Clone(); | 60 std::unique_ptr<shell::Connector> new_connector = connector_->Clone(); |
61 std::unique_ptr<shell::ServiceContextRef> context_ref = | 61 std::unique_ptr<shell::ServiceContextRef> context_ref = |
62 ref_factory_.CreateRef(); | 62 ref_factory_.CreateRef(); |
63 view_task_runner_->PostTask( | 63 view_task_runner_->PostTask( |
64 FROM_HERE, | 64 FROM_HERE, |
65 base::Bind(&CreateViewOnViewTaskRunner, base::Passed(&new_connector), | 65 base::Bind(&CreateViewOnViewTaskRunner, base::Passed(&new_connector), |
66 client_user_id_, base::Passed(&client), base::Passed(&request), | 66 client_user_id_, base::Passed(&client), base::Passed(&request), |
67 base::Passed(&context_ref))); | 67 base::Passed(&context_ref))); |
68 } | 68 } |
69 | 69 |
70 void Navigation::ViewFactoryLost() { | 70 void Navigation::ViewFactoryLost() { |
71 refs_.erase(refs_.begin()); | 71 refs_.erase(refs_.begin()); |
72 } | 72 } |
73 | 73 |
74 } // navigation | 74 } // navigation |
OLD | NEW |