Chromium Code Reviews

Side by Side Diff: services/ui/view_manager/view_associate_table.cc

Issue 1919313002: ApplicationImpl::ConnectToServiceDeprecated() -> mojo::ConnectToService() conversion, part 3. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « services/ui/launcher/launch_instance.cc ('k') | services/ui/view_manager/view_manager_app.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_associate_table.h" 5 #include "services/ui/view_manager/view_associate_table.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "mojo/public/cpp/application/connect.h"
11 #include "mojo/services/ui/views/cpp/formatting.h" 12 #include "mojo/services/ui/views/cpp/formatting.h"
12 13
13 namespace view_manager { 14 namespace view_manager {
14 15
15 template <typename T> 16 template <typename T>
16 static bool Contains(const mojo::Array<T>& array, const T& value) { 17 static bool Contains(const mojo::Array<T>& array, const T& value) {
17 return std::find(array.storage().cbegin(), array.storage().cend(), value) != 18 return std::find(array.storage().cbegin(), array.storage().cend(), value) !=
18 array.storage().cend(); 19 array.storage().cend();
19 } 20 }
20 21
21 ViewAssociateTable::ViewAssociateTable() {} 22 ViewAssociateTable::ViewAssociateTable() {}
22 23
23 ViewAssociateTable::~ViewAssociateTable() {} 24 ViewAssociateTable::~ViewAssociateTable() {}
24 25
25 void ViewAssociateTable::ConnectAssociates( 26 void ViewAssociateTable::ConnectAssociates(
26 mojo::ApplicationImpl* app_impl, 27 mojo::ApplicationImpl* app_impl,
27 mojo::ui::ViewInspector* inspector, 28 mojo::ui::ViewInspector* inspector,
28 const std::vector<std::string>& urls, 29 const std::vector<std::string>& urls,
29 const AssociateConnectionErrorCallback& connection_error_callback) { 30 const AssociateConnectionErrorCallback& connection_error_callback) {
30 DCHECK(app_impl); 31 DCHECK(app_impl);
31 DCHECK(inspector); 32 DCHECK(inspector);
32 33
33 for (auto& url : urls) { 34 for (auto& url : urls) {
34 DVLOG(1) << "Connecting to view associate: url=" << url; 35 DVLOG(1) << "Connecting to view associate: url=" << url;
35 associates_.emplace_back(new AssociateData(url, inspector)); 36 associates_.emplace_back(new AssociateData(url, inspector));
36 AssociateData* data = associates_.back().get(); 37 AssociateData* data = associates_.back().get();
37 38
38 app_impl->ConnectToServiceDeprecated(url, &data->associate); 39 mojo::ConnectToService(app_impl->shell(), url, GetProxy(&data->associate));
39 data->associate.set_connection_error_handler( 40 data->associate.set_connection_error_handler(
40 base::Bind(connection_error_callback, url)); 41 base::Bind(connection_error_callback, url));
41 42
42 mojo::ui::ViewInspectorPtr inspector; 43 mojo::ui::ViewInspectorPtr inspector;
43 data->inspector_binding.Bind(mojo::GetProxy(&inspector)); 44 data->inspector_binding.Bind(GetProxy(&inspector));
44 data->associate->Connect( 45 data->associate->Connect(
45 inspector.Pass(), 46 inspector.Pass(),
46 base::Bind(&ViewAssociateTable::OnConnected, base::Unretained(this), 47 base::Bind(&ViewAssociateTable::OnConnected, base::Unretained(this),
47 pending_connection_count_)); 48 pending_connection_count_));
48 49
49 pending_connection_count_++; 50 pending_connection_count_++;
50 } 51 }
51 } 52 }
52 53
53 void ViewAssociateTable::ConnectToViewService( 54 void ViewAssociateTable::ConnectToViewService(
(...skipping 80 matching lines...)
134 } 135 }
135 136
136 ViewAssociateTable::AssociateData::AssociateData( 137 ViewAssociateTable::AssociateData::AssociateData(
137 const std::string& url, 138 const std::string& url,
138 mojo::ui::ViewInspector* inspector) 139 mojo::ui::ViewInspector* inspector)
139 : url(url), inspector_binding(inspector) {} 140 : url(url), inspector_binding(inspector) {}
140 141
141 ViewAssociateTable::AssociateData::~AssociateData() {} 142 ViewAssociateTable::AssociateData::~AssociateData() {}
142 143
143 } // namespace view_manager 144 } // namespace view_manager
OLDNEW
« no previous file with comments | « services/ui/launcher/launch_instance.cc ('k') | services/ui/view_manager/view_manager_app.cc » ('j') | no next file with comments »

Powered by Google App Engine