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" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/process/process.h" | 13 #include "base/process/process.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
17 #include "mojo/services/catalog/public/interfaces/catalog.mojom.h" | 17 #include "mojo/services/catalog/public/interfaces/catalog.mojom.h" |
18 #include "mojo/shell/public/cpp/connection.h" | 18 #include "mojo/shell/public/cpp/connection.h" |
19 #include "mojo/shell/public/cpp/connector.h" | 19 #include "mojo/shell/public/cpp/connector.h" |
20 #include "mojo/shell/public/interfaces/shell.mojom.h" | 20 #include "mojo/shell/public/interfaces/shell.mojom.h" |
21 #include "ui/base/models/table_model.h" | 21 #include "ui/base/models/table_model.h" |
22 #include "ui/base/resource/resource_bundle.h" | |
23 #include "ui/resources/grit/ui_resources.h" | |
22 #include "ui/views/background.h" | 24 #include "ui/views/background.h" |
23 #include "ui/views/controls/button/label_button.h" | 25 #include "ui/views/controls/button/label_button.h" |
24 #include "ui/views/controls/table/table_view.h" | 26 #include "ui/views/controls/table/table_view.h" |
25 #include "ui/views/controls/table/table_view_observer.h" | 27 #include "ui/views/controls/table/table_view_observer.h" |
26 #include "ui/views/mus/aura_init.h" | 28 #include "ui/views/mus/aura_init.h" |
27 #include "ui/views/mus/window_manager_connection.h" | 29 #include "ui/views/mus/window_manager_connection.h" |
28 #include "ui/views/widget/widget_delegate.h" | 30 #include "ui/views/widget/widget_delegate.h" |
29 | 31 |
30 namespace mash { | 32 namespace mash { |
31 namespace task_viewer { | 33 namespace task_viewer { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 }; | 82 }; |
81 | 83 |
82 | 84 |
83 // Overridden from views::WidgetDelegate: | 85 // Overridden from views::WidgetDelegate: |
84 views::View* GetContentsView() override { return this; } | 86 views::View* GetContentsView() override { return this; } |
85 base::string16 GetWindowTitle() const override { | 87 base::string16 GetWindowTitle() const override { |
86 // TODO(beng): use resources. | 88 // TODO(beng): use resources. |
87 return base::ASCIIToUTF16("Tasks"); | 89 return base::ASCIIToUTF16("Tasks"); |
88 } | 90 } |
89 | 91 |
92 gfx::ImageSkia GetWindowAppIcon() override { | |
93 // TODO(jamescook): Create a new .pak file for this app and use a custom | |
msw
2016/03/24 17:40:54
Hmm, if this relies on chrome's image resources, w
James Cook
2016/03/25 15:39:28
This icon isn't from Chrome or Ash. For better or
| |
94 // icon, perhaps similar to the Chrome OS task viewer. | |
95 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | |
96 return *rb.GetImageSkiaNamed(IDR_NOTIFICATION_SETTINGS); | |
97 } | |
98 | |
90 // Overridden from views::View: | 99 // Overridden from views::View: |
91 void Layout() override { | 100 void Layout() override { |
92 gfx::Rect bounds = GetLocalBounds(); | 101 gfx::Rect bounds = GetLocalBounds(); |
93 bounds.Inset(10, 10); | 102 bounds.Inset(10, 10); |
94 | 103 |
95 gfx::Size ps = kill_button_->GetPreferredSize(); | 104 gfx::Size ps = kill_button_->GetPreferredSize(); |
96 bounds.set_height(bounds.height() - ps.height() - 10); | 105 bounds.set_height(bounds.height() - ps.height() - 10); |
97 | 106 |
98 kill_button_->SetBounds(bounds.width() - ps.width(), | 107 kill_button_->SetBounds(bounds.width() - ps.width(), |
99 bounds.bottom() + 10, | 108 bounds.bottom() + 10, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
278 | 287 |
279 TaskViewerContents* task_viewer = new TaskViewerContents( | 288 TaskViewerContents* task_viewer = new TaskViewerContents( |
280 std::move(request), std::move(catalog)); | 289 std::move(request), std::move(catalog)); |
281 views::Widget* window = views::Widget::CreateWindowWithBounds( | 290 views::Widget* window = views::Widget::CreateWindowWithBounds( |
282 task_viewer, gfx::Rect(10, 10, 500, 500)); | 291 task_viewer, gfx::Rect(10, 10, 500, 500)); |
283 window->Show(); | 292 window->Show(); |
284 } | 293 } |
285 | 294 |
286 } // namespace task_viewer | 295 } // namespace task_viewer |
287 } // namespace main | 296 } // namespace main |
OLD | NEW |