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_TASK_MANAGER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TASK_MANAGER_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TASK_MANAGER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TASK_MANAGER_VIEW_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 // views::ContextMenuController: | 80 // views::ContextMenuController: |
81 void ShowContextMenuForView(views::View* source, | 81 void ShowContextMenuForView(views::View* source, |
82 const gfx::Point& point, | 82 const gfx::Point& point, |
83 ui::MenuSourceType source_type) override; | 83 ui::MenuSourceType source_type) override; |
84 | 84 |
85 // ui::SimpleMenuModel::Delegate: | 85 // ui::SimpleMenuModel::Delegate: |
86 bool IsCommandIdChecked(int id) const override; | 86 bool IsCommandIdChecked(int id) const override; |
87 bool IsCommandIdEnabled(int id) const override; | 87 bool IsCommandIdEnabled(int id) const override; |
88 void ExecuteCommand(int id, int event_flags) override; | 88 void ExecuteCommand(int id, int event_flags) override; |
| 89 void MenuClosed(ui::SimpleMenuModel* source) override; |
89 | 90 |
90 private: | 91 private: |
91 friend class TaskManagerViewTest; | 92 friend class TaskManagerViewTest; |
92 | 93 |
93 TaskManagerView(); | 94 TaskManagerView(); |
94 | 95 |
95 static TaskManagerView* GetInstanceForTests(); | 96 static TaskManagerView* GetInstanceForTests(); |
96 | 97 |
97 // Creates the child controls. | 98 // Creates the child controls. |
98 void Init(); | 99 void Init(); |
99 | 100 |
100 // Initializes the state of the always-on-top setting as the window is shown. | 101 // Initializes the state of the always-on-top setting as the window is shown. |
101 void InitAlwaysOnTopState(); | 102 void InitAlwaysOnTopState(); |
102 | 103 |
103 // Activates the tab associated with the selected row. | 104 // Activates the tab associated with the selected row. |
104 void ActivateSelectedTab(); | 105 void ActivateSelectedTab(); |
105 | 106 |
106 // Selects the active tab in the specified browser window. | 107 // Selects the active tab in the specified browser window. |
107 void SelectTaskOfActiveTab(Browser* browser); | 108 void SelectTaskOfActiveTab(Browser* browser); |
108 | 109 |
109 // Restores saved "always on top" state from a previous session. | 110 // Restores saved "always on top" state from a previous session. |
110 void RetrieveSavedAlwaysOnTopState(); | 111 void RetrieveSavedAlwaysOnTopState(); |
111 | 112 |
112 std::unique_ptr<TaskManagerTableModel> table_model_; | 113 std::unique_ptr<TaskManagerTableModel> table_model_; |
113 | 114 |
| 115 std::unique_ptr<ui::SimpleMenuModel> menu_model_; |
114 std::unique_ptr<views::MenuRunner> menu_runner_; | 116 std::unique_ptr<views::MenuRunner> menu_runner_; |
115 | 117 |
116 // 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. |
117 base::string16 always_on_top_menu_text_; | 119 base::string16 always_on_top_menu_text_; |
118 | 120 |
119 views::TableView* tab_table_; | 121 views::TableView* tab_table_; |
120 views::View* tab_table_parent_; | 122 views::View* tab_table_parent_; |
121 | 123 |
122 // all possible columns, not necessarily visible | 124 // all possible columns, not necessarily visible |
123 std::vector<ui::TableColumn> columns_; | 125 std::vector<ui::TableColumn> columns_; |
124 | 126 |
125 // 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. |
126 bool is_always_on_top_; | 128 bool is_always_on_top_; |
127 | 129 |
128 DISALLOW_COPY_AND_ASSIGN(TaskManagerView); | 130 DISALLOW_COPY_AND_ASSIGN(TaskManagerView); |
129 }; | 131 }; |
130 | 132 |
131 } // namespace task_manager | 133 } // namespace task_manager |
132 | 134 |
133 #endif // CHROME_BROWSER_UI_VIEWS_TASK_MANAGER_VIEW_H_ | 135 #endif // CHROME_BROWSER_UI_VIEWS_TASK_MANAGER_VIEW_H_ |
OLD | NEW |