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

Side by Side Diff: mash/task_viewer/task_viewer.cc

Issue 2617883002: Add a new BindInterface() method to Connector. (Closed)
Patch Set: . Created 3 years, 11 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 | « mash/quick_launch/quick_launch.cc ('k') | mash/webtest/webtest.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 "mash/task_viewer/task_viewer.h" 5 #include "mash/task_viewer/task_viewer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 307
308 void TaskViewer::Launch(uint32_t what, mojom::LaunchMode how) { 308 void TaskViewer::Launch(uint32_t what, mojom::LaunchMode how) {
309 bool reuse = how == mojom::LaunchMode::REUSE || 309 bool reuse = how == mojom::LaunchMode::REUSE ||
310 how == mojom::LaunchMode::DEFAULT; 310 how == mojom::LaunchMode::DEFAULT;
311 if (reuse && !windows_.empty()) { 311 if (reuse && !windows_.empty()) {
312 windows_.back()->Activate(); 312 windows_.back()->Activate();
313 return; 313 return;
314 } 314 }
315 315
316 service_manager::mojom::ServiceManagerPtr service_manager; 316 service_manager::mojom::ServiceManagerPtr service_manager;
317 context()->connector()->ConnectToInterface( 317 context()->connector()->BindInterface(service_manager::mojom::kServiceName,
318 service_manager::mojom::kServiceName, &service_manager); 318 &service_manager);
319 319
320 service_manager::mojom::ServiceManagerListenerPtr listener; 320 service_manager::mojom::ServiceManagerListenerPtr listener;
321 service_manager::mojom::ServiceManagerListenerRequest request(&listener); 321 service_manager::mojom::ServiceManagerListenerRequest request(&listener);
322 service_manager->AddListener(std::move(listener)); 322 service_manager->AddListener(std::move(listener));
323 323
324 catalog::mojom::CatalogPtr catalog; 324 catalog::mojom::CatalogPtr catalog;
325 context()->connector()->ConnectToInterface(catalog::mojom::kServiceName, 325 context()->connector()->BindInterface(catalog::mojom::kServiceName, &catalog);
326 &catalog);
327 326
328 TaskViewerContents* task_viewer = new TaskViewerContents( 327 TaskViewerContents* task_viewer = new TaskViewerContents(
329 this, std::move(request), std::move(catalog)); 328 this, std::move(request), std::move(catalog));
330 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( 329 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds(
331 task_viewer, nullptr, gfx::Rect(10, 10, 500, 500)); 330 task_viewer, nullptr, gfx::Rect(10, 10, 500, 500));
332 window->Show(); 331 window->Show();
333 windows_.push_back(window); 332 windows_.push_back(window);
334 } 333 }
335 334
336 void TaskViewer::Create(const service_manager::Identity& remote_identity, 335 void TaskViewer::Create(const service_manager::Identity& remote_identity,
337 ::mash::mojom::LaunchableRequest request) { 336 ::mash::mojom::LaunchableRequest request) {
338 bindings_.AddBinding(this, std::move(request)); 337 bindings_.AddBinding(this, std::move(request));
339 } 338 }
340 339
341 } // namespace task_viewer 340 } // namespace task_viewer
342 } // namespace main 341 } // namespace main
OLDNEW
« no previous file with comments | « mash/quick_launch/quick_launch.cc ('k') | mash/webtest/webtest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698