OLD | NEW |
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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 TaskViewer::~TaskViewer() {} | 276 TaskViewer::~TaskViewer() {} |
277 | 277 |
278 void TaskViewer::RemoveWindow(views::Widget* widget) { | 278 void TaskViewer::RemoveWindow(views::Widget* widget) { |
279 auto it = std::find(windows_.begin(), windows_.end(), widget); | 279 auto it = std::find(windows_.begin(), windows_.end(), widget); |
280 DCHECK(it != windows_.end()); | 280 DCHECK(it != windows_.end()); |
281 windows_.erase(it); | 281 windows_.erase(it); |
282 if (windows_.empty()) | 282 if (windows_.empty()) |
283 base::MessageLoop::current()->QuitWhenIdle(); | 283 base::MessageLoop::current()->QuitWhenIdle(); |
284 } | 284 } |
285 | 285 |
286 void TaskViewer::Initialize(shell::Connector* connector, | 286 void TaskViewer::OnStart(shell::Connector* connector, |
287 const shell::Identity& identity, | 287 const shell::Identity& identity, |
288 uint32_t id) { | 288 uint32_t id) { |
289 connector_ = connector; | 289 connector_ = connector; |
290 tracing_.Initialize(connector, identity.name()); | 290 tracing_.Initialize(connector, identity.name()); |
291 | 291 |
292 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); | 292 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); |
293 window_manager_connection_ = | 293 window_manager_connection_ = |
294 views::WindowManagerConnection::Create(connector, identity); | 294 views::WindowManagerConnection::Create(connector, identity); |
295 } | 295 } |
296 | 296 |
297 bool TaskViewer::AcceptConnection(shell::Connection* connection) { | 297 bool TaskViewer::OnConnect(shell::Connection* connection) { |
298 connection->AddInterface<mojom::Launchable>(this); | 298 connection->AddInterface<mojom::Launchable>(this); |
299 return true; | 299 return true; |
300 } | 300 } |
301 | 301 |
302 void TaskViewer::Launch(uint32_t what, mojom::LaunchMode how) { | 302 void TaskViewer::Launch(uint32_t what, mojom::LaunchMode how) { |
303 bool reuse = how == mojom::LaunchMode::REUSE || | 303 bool reuse = how == mojom::LaunchMode::REUSE || |
304 how == mojom::LaunchMode::DEFAULT; | 304 how == mojom::LaunchMode::DEFAULT; |
305 if (reuse && !windows_.empty()) { | 305 if (reuse && !windows_.empty()) { |
306 windows_.back()->Activate(); | 306 windows_.back()->Activate(); |
307 return; | 307 return; |
(...skipping 17 matching lines...) Expand all Loading... |
325 windows_.push_back(window); | 325 windows_.push_back(window); |
326 } | 326 } |
327 | 327 |
328 void TaskViewer::Create(shell::Connection* connection, | 328 void TaskViewer::Create(shell::Connection* connection, |
329 mojom::LaunchableRequest request) { | 329 mojom::LaunchableRequest request) { |
330 bindings_.AddBinding(this, std::move(request)); | 330 bindings_.AddBinding(this, std::move(request)); |
331 } | 331 } |
332 | 332 |
333 } // namespace task_viewer | 333 } // namespace task_viewer |
334 } // namespace main | 334 } // namespace main |
OLD | NEW |