| 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" | |
| 16 #include "ui/views/controls/menu/menu_runner.h" | 15 #include "ui/views/controls/menu/menu_runner.h" |
| 17 #include "ui/views/controls/table/table_grouper.h" | 16 #include "ui/views/controls/table/table_grouper.h" |
| 18 #include "ui/views/controls/table/table_view_observer.h" | 17 #include "ui/views/controls/table/table_view_observer.h" |
| 19 #include "ui/views/window/dialog_delegate.h" | 18 #include "ui/views/window/dialog_delegate.h" |
| 20 | 19 |
| 21 class Browser; | 20 class Browser; |
| 22 | 21 |
| 23 namespace views { | 22 namespace views { |
| 24 class LabelButton; | |
| 25 class Link; | 23 class Link; |
| 26 class TableView; | 24 class TableView; |
| 27 class View; | 25 class View; |
| 28 } // namespace views | 26 } // namespace views |
| 29 | 27 |
| 30 namespace task_management { | 28 namespace task_management { |
| 31 | 29 |
| 32 class TaskManagerTableModel; | 30 class TaskManagerTableModel; |
| 33 | 31 |
| 34 // The new task manager UI container. | 32 // The new task manager UI container. |
| 35 class NewTaskManagerView | 33 class NewTaskManagerView |
| 36 : public TableViewDelegate, | 34 : public TableViewDelegate, |
| 37 public views::ButtonListener, | |
| 38 public views::DialogDelegateView, | 35 public views::DialogDelegateView, |
| 39 public views::TableGrouper, | 36 public views::TableGrouper, |
| 40 public views::TableViewObserver, | 37 public views::TableViewObserver, |
| 41 public views::ContextMenuController, | 38 public views::ContextMenuController, |
| 42 public ui::SimpleMenuModel::Delegate { | 39 public ui::SimpleMenuModel::Delegate { |
| 43 public: | 40 public: |
| 44 ~NewTaskManagerView() override; | 41 ~NewTaskManagerView() override; |
| 45 | 42 |
| 46 // Shows the Task Manager window, or re-activates an existing one. | 43 // Shows the Task Manager window, or re-activates an existing one. |
| 47 static task_management::TaskManagerTableModel* Show(Browser* browser); | 44 static task_management::TaskManagerTableModel* Show(Browser* browser); |
| 48 | 45 |
| 49 // Hides the Task Manager if it is showing. | 46 // Hides the Task Manager if it is showing. |
| 50 static void Hide(); | 47 static void Hide(); |
| 51 | 48 |
| 52 // task_management::TableViewDelegate: | 49 // task_management::TableViewDelegate: |
| 53 bool IsColumnVisible(int column_id) const override; | 50 bool IsColumnVisible(int column_id) const override; |
| 54 void SetColumnVisibility(int column_id, bool new_visibility) override; | 51 void SetColumnVisibility(int column_id, bool new_visibility) override; |
| 55 bool IsTableSorted() const override; | 52 bool IsTableSorted() const override; |
| 56 TableSortDescriptor GetSortDescriptor() const override; | 53 TableSortDescriptor GetSortDescriptor() const override; |
| 57 void ToggleSortOrder(int visible_column_index) override; | 54 void ToggleSortOrder(int visible_column_index) override; |
| 58 | 55 |
| 59 // views::View: | 56 // views::View: |
| 60 void Layout() override; | |
| 61 gfx::Size GetPreferredSize() const override; | 57 gfx::Size GetPreferredSize() const override; |
| 62 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 58 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
| 63 void ViewHierarchyChanged( | |
| 64 const ViewHierarchyChangedDetails& details) override; | |
| 65 | |
| 66 // views::ButtonListener: | |
| 67 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
| 68 | 59 |
| 69 // views::DialogDelegateView: | 60 // views::DialogDelegateView: |
| 70 bool CanResize() const override; | 61 bool CanResize() const override; |
| 71 bool CanMaximize() const override; | 62 bool CanMaximize() const override; |
| 72 bool CanMinimize() const override; | 63 bool CanMinimize() const override; |
| 73 bool ExecuteWindowsCommand(int command_id) override; | 64 bool ExecuteWindowsCommand(int command_id) override; |
| 74 base::string16 GetWindowTitle() const override; | 65 base::string16 GetWindowTitle() const override; |
| 75 std::string GetWindowName() const override; | 66 std::string GetWindowName() const override; |
| 67 bool Accept() override; |
| 68 bool Close() override; |
| 76 int GetDialogButtons() const override; | 69 int GetDialogButtons() const override; |
| 70 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 71 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 77 void WindowClosing() override; | 72 void WindowClosing() override; |
| 78 bool UseNewStyleForThisDialog() const override; | 73 bool UseNewStyleForThisDialog() const override; |
| 79 | 74 |
| 80 // views::TableGrouper: | 75 // views::TableGrouper: |
| 81 void GetGroupRange(int model_index, views::GroupRange* range) override; | 76 void GetGroupRange(int model_index, views::GroupRange* range) override; |
| 82 | 77 |
| 83 // views::TableViewObserver: | 78 // views::TableViewObserver: |
| 84 void OnSelectionChanged() override; | 79 void OnSelectionChanged() override; |
| 85 void OnDoubleClick() override; | 80 void OnDoubleClick() override; |
| 86 void OnKeyDown(ui::KeyboardCode keycode) override; | 81 void OnKeyDown(ui::KeyboardCode keycode) override; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 107 // Creates the child controls. | 102 // Creates the child controls. |
| 108 void Init(); | 103 void Init(); |
| 109 | 104 |
| 110 // Initializes the state of the always-on-top setting as the window is shown. | 105 // Initializes the state of the always-on-top setting as the window is shown. |
| 111 void InitAlwaysOnTopState(); | 106 void InitAlwaysOnTopState(); |
| 112 | 107 |
| 113 // Activates the tab associated with the focused row. | 108 // Activates the tab associated with the focused row. |
| 114 void ActivateFocusedTab(); | 109 void ActivateFocusedTab(); |
| 115 | 110 |
| 116 // Restores saved "always on top" state from a previous session. | 111 // Restores saved "always on top" state from a previous session. |
| 117 void RetriveSavedAlwaysOnTopState(); | 112 void RetrieveSavedAlwaysOnTopState(); |
| 118 | 113 |
| 119 std::unique_ptr<TaskManagerTableModel> table_model_; | 114 std::unique_ptr<TaskManagerTableModel> table_model_; |
| 120 | 115 |
| 121 std::unique_ptr<views::MenuRunner> menu_runner_; | 116 std::unique_ptr<views::MenuRunner> menu_runner_; |
| 122 | 117 |
| 123 // We need to own the text of the menu, the Windows API does not copy it. | 118 // We need to own the text of the menu, the Windows API does not copy it. |
| 124 base::string16 always_on_top_menu_text_; | 119 base::string16 always_on_top_menu_text_; |
| 125 | 120 |
| 126 views::LabelButton* kill_button_; | |
| 127 views::TableView* tab_table_; | 121 views::TableView* tab_table_; |
| 128 views::View* tab_table_parent_; | 122 views::View* tab_table_parent_; |
| 129 | 123 |
| 130 // all possible columns, not necessarily visible | 124 // all possible columns, not necessarily visible |
| 131 std::vector<ui::TableColumn> columns_; | 125 std::vector<ui::TableColumn> columns_; |
| 132 | 126 |
| 133 // True when the Task Manager window should be shown on top of other windows. | 127 // True when the Task Manager window should be shown on top of other windows. |
| 134 bool is_always_on_top_; | 128 bool is_always_on_top_; |
| 135 | 129 |
| 136 DISALLOW_COPY_AND_ASSIGN(NewTaskManagerView); | 130 DISALLOW_COPY_AND_ASSIGN(NewTaskManagerView); |
| 137 }; | 131 }; |
| 138 | 132 |
| 139 } // namespace task_management | 133 } // namespace task_management |
| 140 | 134 |
| 141 #endif // CHROME_BROWSER_UI_VIEWS_NEW_TASK_MANAGER_VIEW_H_ | 135 #endif // CHROME_BROWSER_UI_VIEWS_NEW_TASK_MANAGER_VIEW_H_ |
| OLD | NEW |