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 #ifndef CHROME_BROWSER_UI_VIEWS_NEW_TASK_MANAGER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_NEW_TASK_MANAGER_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_NEW_TASK_MANAGER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_NEW_TASK_MANAGER_VIEW_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "chrome/browser/ui/task_manager/task_manager_table_model.h" | 11 #include "chrome/browser/ui/task_manager/task_manager_table_model.h" |
12 #include "ui/base/models/simple_menu_model.h" | 12 #include "ui/base/models/simple_menu_model.h" |
13 #include "ui/base/models/table_model.h" | 13 #include "ui/base/models/table_model.h" |
14 #include "ui/views/context_menu_controller.h" | 14 #include "ui/views/context_menu_controller.h" |
15 #include "ui/views/controls/button/label_button.h" | 15 #include "ui/views/controls/button/label_button.h" |
16 #include "ui/views/controls/link_listener.h" | |
17 #include "ui/views/controls/menu/menu_runner.h" | 16 #include "ui/views/controls/menu/menu_runner.h" |
18 #include "ui/views/controls/table/table_grouper.h" | 17 #include "ui/views/controls/table/table_grouper.h" |
19 #include "ui/views/controls/table/table_view_observer.h" | 18 #include "ui/views/controls/table/table_view_observer.h" |
20 #include "ui/views/window/dialog_delegate.h" | 19 #include "ui/views/window/dialog_delegate.h" |
21 | 20 |
22 class Browser; | 21 class Browser; |
23 | 22 |
24 namespace views { | 23 namespace views { |
25 class LabelButton; | 24 class LabelButton; |
26 class Link; | 25 class Link; |
27 class TableView; | 26 class TableView; |
28 class View; | 27 class View; |
29 } // namespace views | 28 } // namespace views |
30 | 29 |
31 namespace task_management { | 30 namespace task_management { |
32 | 31 |
33 class TaskManagerTableModel; | 32 class TaskManagerTableModel; |
34 | 33 |
35 // The new task manager UI container. | 34 // The new task manager UI container. |
36 class NewTaskManagerView | 35 class NewTaskManagerView |
37 : public TableViewDelegate, | 36 : public TableViewDelegate, |
38 public views::ButtonListener, | 37 public views::ButtonListener, |
39 public views::DialogDelegateView, | 38 public views::DialogDelegateView, |
40 public views::TableGrouper, | 39 public views::TableGrouper, |
41 public views::TableViewObserver, | 40 public views::TableViewObserver, |
42 public views::LinkListener, | |
43 public views::ContextMenuController, | 41 public views::ContextMenuController, |
44 public ui::SimpleMenuModel::Delegate { | 42 public ui::SimpleMenuModel::Delegate { |
45 public: | 43 public: |
46 ~NewTaskManagerView() override; | 44 ~NewTaskManagerView() override; |
47 | 45 |
48 // Shows the Task Manager window, or re-activates an existing one. | 46 // Shows the Task Manager window, or re-activates an existing one. |
49 static void Show(Browser* browser); | 47 static void Show(Browser* browser); |
50 | 48 |
51 // Hides the Task Manager if it is showing. | 49 // Hides the Task Manager if it is showing. |
52 static void Hide(); | 50 static void Hide(); |
(...skipping 27 matching lines...) Expand all Loading... |
80 bool UseNewStyleForThisDialog() const override; | 78 bool UseNewStyleForThisDialog() const override; |
81 | 79 |
82 // views::TableGrouper: | 80 // views::TableGrouper: |
83 void GetGroupRange(int model_index, views::GroupRange* range) override; | 81 void GetGroupRange(int model_index, views::GroupRange* range) override; |
84 | 82 |
85 // views::TableViewObserver: | 83 // views::TableViewObserver: |
86 void OnSelectionChanged() override; | 84 void OnSelectionChanged() override; |
87 void OnDoubleClick() override; | 85 void OnDoubleClick() override; |
88 void OnKeyDown(ui::KeyboardCode keycode) override; | 86 void OnKeyDown(ui::KeyboardCode keycode) override; |
89 | 87 |
90 // views::LinkListener: | |
91 void LinkClicked(views::Link* source, int event_flags) override; | |
92 | |
93 // views::ContextMenuController: | 88 // views::ContextMenuController: |
94 void ShowContextMenuForView(views::View* source, | 89 void ShowContextMenuForView(views::View* source, |
95 const gfx::Point& point, | 90 const gfx::Point& point, |
96 ui::MenuSourceType source_type) override; | 91 ui::MenuSourceType source_type) override; |
97 | 92 |
98 // ui::SimpleMenuModel::Delegate: | 93 // ui::SimpleMenuModel::Delegate: |
99 bool IsCommandIdChecked(int id) const override; | 94 bool IsCommandIdChecked(int id) const override; |
100 bool IsCommandIdEnabled(int id) const override; | 95 bool IsCommandIdEnabled(int id) const override; |
101 bool GetAcceleratorForCommandId(int command_id, | 96 bool GetAcceleratorForCommandId(int command_id, |
102 ui::Accelerator* accelerator) override; | 97 ui::Accelerator* accelerator) override; |
(...skipping 19 matching lines...) Expand all Loading... |
122 void RetriveSavedAlwaysOnTopState(); | 117 void RetriveSavedAlwaysOnTopState(); |
123 | 118 |
124 scoped_ptr<TaskManagerTableModel> table_model_; | 119 scoped_ptr<TaskManagerTableModel> table_model_; |
125 | 120 |
126 scoped_ptr<views::MenuRunner> menu_runner_; | 121 scoped_ptr<views::MenuRunner> menu_runner_; |
127 | 122 |
128 // We need to own the text of the menu, the Windows API does not copy it. | 123 // We need to own the text of the menu, the Windows API does not copy it. |
129 base::string16 always_on_top_menu_text_; | 124 base::string16 always_on_top_menu_text_; |
130 | 125 |
131 views::LabelButton* kill_button_; | 126 views::LabelButton* kill_button_; |
132 views::Link* about_memory_link_; | |
133 views::TableView* tab_table_; | 127 views::TableView* tab_table_; |
134 views::View* tab_table_parent_; | 128 views::View* tab_table_parent_; |
135 | 129 |
136 // all possible columns, not necessarily visible | 130 // all possible columns, not necessarily visible |
137 std::vector<ui::TableColumn> columns_; | 131 std::vector<ui::TableColumn> columns_; |
138 | 132 |
139 // True when the Task Manager window should be shown on top of other windows. | 133 // True when the Task Manager window should be shown on top of other windows. |
140 bool is_always_on_top_; | 134 bool is_always_on_top_; |
141 | 135 |
142 DISALLOW_COPY_AND_ASSIGN(NewTaskManagerView); | 136 DISALLOW_COPY_AND_ASSIGN(NewTaskManagerView); |
143 }; | 137 }; |
144 | 138 |
145 } // namespace task_management | 139 } // namespace task_management |
146 | 140 |
147 #endif // CHROME_BROWSER_UI_VIEWS_NEW_TASK_MANAGER_VIEW_H_ | 141 #endif // CHROME_BROWSER_UI_VIEWS_NEW_TASK_MANAGER_VIEW_H_ |
OLD | NEW |