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

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

Issue 2425563004: Support reading multiple InterfaceProviderSpecs from manifests (Closed)
Patch Set: . Created 4 years, 1 month 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') | services/catalog/entry.h » ('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 16 matching lines...) Expand all
27 #include "ui/views/controls/table/table_view.h" 27 #include "ui/views/controls/table/table_view.h"
28 #include "ui/views/controls/table/table_view_observer.h" 28 #include "ui/views/controls/table/table_view_observer.h"
29 #include "ui/views/mus/aura_init.h" 29 #include "ui/views/mus/aura_init.h"
30 #include "ui/views/mus/window_manager_connection.h" 30 #include "ui/views/mus/window_manager_connection.h"
31 #include "ui/views/widget/widget_delegate.h" 31 #include "ui/views/widget/widget_delegate.h"
32 32
33 namespace mash { 33 namespace mash {
34 namespace task_viewer { 34 namespace task_viewer {
35 namespace { 35 namespace {
36 36
37 using service_manager::mojom::ServiceInfoPtr; 37 using service_manager::mojom::RunningServiceInfoPtr;
38 38
39 class TaskViewerContents 39 class TaskViewerContents
40 : public views::WidgetDelegateView, 40 : public views::WidgetDelegateView,
41 public ui::TableModel, 41 public ui::TableModel,
42 public views::ButtonListener, 42 public views::ButtonListener,
43 public service_manager::mojom::ServiceManagerListener { 43 public service_manager::mojom::ServiceManagerListener {
44 public: 44 public:
45 TaskViewerContents( 45 TaskViewerContents(
46 TaskViewer* task_viewer, 46 TaskViewer* task_viewer,
47 service_manager::mojom::ServiceManagerListenerRequest request, 47 service_manager::mojom::ServiceManagerListenerRequest request,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 void ButtonPressed(views::Button* sender, const ui::Event& event) override { 143 void ButtonPressed(views::Button* sender, const ui::Event& event) override {
144 DCHECK_EQ(sender, kill_button_); 144 DCHECK_EQ(sender, kill_button_);
145 DCHECK_EQ(table_view_->SelectedRowCount(), 1); 145 DCHECK_EQ(table_view_->SelectedRowCount(), 1);
146 int row = table_view_->FirstSelectedRow(); 146 int row = table_view_->FirstSelectedRow();
147 DCHECK(row < static_cast<int>(instances_.size())); 147 DCHECK(row < static_cast<int>(instances_.size()));
148 base::Process process = base::Process::Open(instances_[row]->pid); 148 base::Process process = base::Process::Open(instances_[row]->pid);
149 process.Terminate(9, true); 149 process.Terminate(9, true);
150 } 150 }
151 151
152 // Overridden from service_manager::mojom::ServiceManagerListener: 152 // Overridden from service_manager::mojom::ServiceManagerListener:
153 void OnInit(std::vector<ServiceInfoPtr> instances) override { 153 void OnInit(std::vector<RunningServiceInfoPtr> instances) override {
154 // This callback should only be called with an empty model. 154 // This callback should only be called with an empty model.
155 DCHECK(instances_.empty()); 155 DCHECK(instances_.empty());
156 std::vector<std::string> names; 156 std::vector<std::string> names;
157 names.reserve(instances.size()); 157 names.reserve(instances.size());
158 for (size_t i = 0; i < instances.size(); ++i) { 158 for (size_t i = 0; i < instances.size(); ++i) {
159 const service_manager::Identity& identity = instances[i]->identity; 159 const service_manager::Identity& identity = instances[i]->identity;
160 InsertInstance(identity, instances[i]->pid); 160 InsertInstance(identity, instances[i]->pid);
161 names.push_back(identity.name()); 161 names.push_back(identity.name());
162 } 162 }
163 catalog_->GetEntries(std::move(names), 163 catalog_->GetEntries(std::move(names),
164 base::Bind(&TaskViewerContents::OnGotCatalogEntries, 164 base::Bind(&TaskViewerContents::OnGotCatalogEntries,
165 weak_ptr_factory_.GetWeakPtr())); 165 weak_ptr_factory_.GetWeakPtr()));
166 } 166 }
167 void OnServiceCreated(ServiceInfoPtr instance) override { 167 void OnServiceCreated(RunningServiceInfoPtr instance) override {
168 service_manager::Identity identity = instance->identity; 168 service_manager::Identity identity = instance->identity;
169 DCHECK(!ContainsIdentity(identity)); 169 DCHECK(!ContainsIdentity(identity));
170 InsertInstance(identity, instance->pid); 170 InsertInstance(identity, instance->pid);
171 observer_->OnItemsAdded(static_cast<int>(instances_.size()), 1); 171 observer_->OnItemsAdded(static_cast<int>(instances_.size()), 1);
172 std::vector<std::string> names; 172 std::vector<std::string> names;
173 names.push_back(identity.name()); 173 names.push_back(identity.name());
174 catalog_->GetEntries(std::move(names), 174 catalog_->GetEntries(std::move(names),
175 base::Bind(&TaskViewerContents::OnGotCatalogEntries, 175 base::Bind(&TaskViewerContents::OnGotCatalogEntries,
176 weak_ptr_factory_.GetWeakPtr())); 176 weak_ptr_factory_.GetWeakPtr()));
177 } 177 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 windows_.push_back(window); 326 windows_.push_back(window);
327 } 327 }
328 328
329 void TaskViewer::Create(const service_manager::Identity& remote_identity, 329 void TaskViewer::Create(const service_manager::Identity& remote_identity,
330 mojom::LaunchableRequest request) { 330 mojom::LaunchableRequest request) {
331 bindings_.AddBinding(this, std::move(request)); 331 bindings_.AddBinding(this, std::move(request));
332 } 332 }
333 333
334 } // namespace task_viewer 334 } // namespace task_viewer
335 } // namespace main 335 } // namespace main
OLDNEW
« no previous file with comments | « mash/quick_launch/quick_launch.cc ('k') | services/catalog/entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698