| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 bool ContainsIdentity(const shell::Identity& identity) const { | 200 bool ContainsIdentity(const shell::Identity& identity) const { |
| 201 for (auto& it : instances_) { | 201 for (auto& it : instances_) { |
| 202 if (it->identity == identity) | 202 if (it->identity == identity) |
| 203 return true; | 203 return true; |
| 204 } | 204 } |
| 205 return false; | 205 return false; |
| 206 } | 206 } |
| 207 | 207 |
| 208 void InsertInstance(const shell::Identity& identity, uint32_t pid) { | 208 void InsertInstance(const shell::Identity& identity, uint32_t pid) { |
| 209 instances_.push_back( | 209 instances_.push_back(base::MakeUnique<InstanceInfo>(identity, pid)); |
| 210 base::WrapUnique(new InstanceInfo(identity, pid))); | |
| 211 } | 210 } |
| 212 | 211 |
| 213 void OnGotCatalogEntries(std::vector<catalog::mojom::EntryPtr> entries) { | 212 void OnGotCatalogEntries(std::vector<catalog::mojom::EntryPtr> entries) { |
| 214 for (auto it = instances_.begin(); it != instances_.end(); ++it) { | 213 for (auto it = instances_.begin(); it != instances_.end(); ++it) { |
| 215 for (auto& entry : entries) { | 214 for (auto& entry : entries) { |
| 216 if (entry->name == (*it)->identity.name()) { | 215 if (entry->name == (*it)->identity.name()) { |
| 217 (*it)->display_name = entry->display_name; | 216 (*it)->display_name = entry->display_name; |
| 218 observer_->OnItemsChanged( | 217 observer_->OnItemsChanged( |
| 219 static_cast<int>(it - instances_.begin()), 1); | 218 static_cast<int>(it - instances_.begin()), 1); |
| 220 break; | 219 break; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 windows_.push_back(window); | 324 windows_.push_back(window); |
| 326 } | 325 } |
| 327 | 326 |
| 328 void TaskViewer::Create(const shell::Identity& remote_identity, | 327 void TaskViewer::Create(const shell::Identity& remote_identity, |
| 329 mojom::LaunchableRequest request) { | 328 mojom::LaunchableRequest request) { |
| 330 bindings_.AddBinding(this, std::move(request)); | 329 bindings_.AddBinding(this, std::move(request)); |
| 331 } | 330 } |
| 332 | 331 |
| 333 } // namespace task_viewer | 332 } // namespace task_viewer |
| 334 } // namespace main | 333 } // namespace main |
| OLD | NEW |