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/ui/view_manager/view_stub.h" | 5 #include "services/ui/view_manager/view_stub.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "services/ui/view_manager/view_registry.h" | 11 #include "services/ui/view_manager/view_registry.h" |
10 #include "services/ui/view_manager/view_state.h" | 12 #include "services/ui/view_manager/view_state.h" |
11 #include "services/ui/view_manager/view_tree_state.h" | 13 #include "services/ui/view_manager/view_tree_state.h" |
12 | 14 |
13 namespace view_manager { | 15 namespace view_manager { |
14 | 16 |
15 ViewStub::ViewStub(ViewRegistry* registry, mojo::ui::ViewOwnerPtr owner) | 17 ViewStub::ViewStub(ViewRegistry* registry, |
16 : registry_(registry), owner_(owner.Pass()) { | 18 mojo::InterfaceHandle<mojo::ui::ViewOwner> owner) |
| 19 : registry_(registry), |
| 20 owner_(mojo::ui::ViewOwnerPtr::Create(std::move(owner))) { |
17 DCHECK(registry_); | 21 DCHECK(registry_); |
18 DCHECK(owner_); | 22 DCHECK(owner_); |
19 | 23 |
20 owner_.set_connection_error_handler( | 24 owner_.set_connection_error_handler( |
21 base::Bind(&ViewStub::OnViewResolved, base::Unretained(this), nullptr)); | 25 base::Bind(&ViewStub::OnViewResolved, base::Unretained(this), nullptr)); |
22 owner_->GetToken( | 26 owner_->GetToken( |
23 base::Bind(&ViewStub::OnViewResolved, base::Unretained(this))); | 27 base::Bind(&ViewStub::OnViewResolved, base::Unretained(this))); |
24 } | 28 } |
25 | 29 |
26 ViewStub::~ViewStub() { | 30 ViewStub::~ViewStub() { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 93 } |
90 } | 94 } |
91 | 95 |
92 void ViewStub::OnViewResolved(mojo::ui::ViewTokenPtr view_token) { | 96 void ViewStub::OnViewResolved(mojo::ui::ViewTokenPtr view_token) { |
93 DCHECK(owner_); | 97 DCHECK(owner_); |
94 owner_.reset(); | 98 owner_.reset(); |
95 registry_->OnViewResolved(this, view_token.Pass()); | 99 registry_->OnViewResolved(this, view_token.Pass()); |
96 } | 100 } |
97 | 101 |
98 } // namespace view_manager | 102 } // namespace view_manager |
OLD | NEW |