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

Unified Diff: chrome/browser/ui/views/new_task_manager_view.h

Issue 1367673003: Expose all reusable task manager view code so it can be used by Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/new_task_manager_view.h
diff --git a/chrome/browser/ui/views/new_task_manager_view.h b/chrome/browser/ui/views/new_task_manager_view.h
index 2291d8af02e06293993967e8a0d560c02d20c6e4..b2c120471944024b9cabb84d8bb521e581bce360 100644
--- a/chrome/browser/ui/views/new_task_manager_view.h
+++ b/chrome/browser/ui/views/new_task_manager_view.h
@@ -14,6 +14,7 @@
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/link_listener.h"
#include "ui/views/controls/menu/menu_runner.h"
+#include "ui/views/controls/table/table_grouper.h"
#include "ui/views/controls/table/table_view_observer.h"
#include "ui/views/window/dialog_delegate.h"
@@ -26,48 +27,13 @@ class View;
namespace task_management {
-// A collection of data to be used in the construction of a task manager table
-// column.
-struct TableColumnData {
- // The generated ID of the column. These can change from one build to another.
- // Their values are controlled by the generation from generated_resources.grd.
- int id;
-
- // The alignment of the text displayed in this column.
- ui::TableColumn::Alignment align;
-
- // |width| and |percent| used to define the size of the column. See
- // ui::TableColumn::width and ui::TableColumn::percent for details.
- int width;
- float percent;
-
- // Is the column sortable.
- bool sortable;
-
- // Is the initial sort order ascending?
- bool initial_sort_is_ascending;
-
- // The default visibility of this column at startup of the table if no
- // visibility is stored for it in the prefs.
- bool default_visibility;
-};
-
-// The task manager table columns and their properties.
-extern const TableColumnData kColumns[];
-extern const size_t kColumnsSize;
-
-// Session Restore Keys.
-extern const char kSortColumnIdKey[];
-extern const char kSortIsAscendingKey[];
-
-// Returns the |column_id| as a string value to be used as keys in the user
-// preferences.
-std::string GetColumnIdAsString(int column_id);
+class TaskManagerTableModel;
// The new task manager UI container.
class NewTaskManagerView
: public views::ButtonListener,
public views::DialogDelegateView,
+ public views::TableGrouper,
public views::TableViewObserver,
public views::LinkListener,
public views::ContextMenuController,
@@ -102,6 +68,9 @@ class NewTaskManagerView
void WindowClosing() override;
bool UseNewStyleForThisDialog() const override;
+ // views::TableGrouper:
+ void GetGroupRange(int model_index, views::GroupRange* range) override;
+
// views::TableViewObserver:
void OnSelectionChanged() override;
void OnDoubleClick() override;
@@ -123,8 +92,8 @@ class NewTaskManagerView
void ExecuteCommand(int id, int event_flags) override;
private:
+ class ViewsTableDelegate;
friend class NewTaskManagerViewTest;
- class TableModel;
explicit NewTaskManagerView(chrome::HostDesktopType desktop_type);
@@ -142,26 +111,12 @@ class NewTaskManagerView
// Restores saved "always on top" state from a previous session.
void RetriveSavedAlwaysOnTopState();
- // Restores the saved columns settings from a previous session into
- // |columns_settings_| and updates the table view.
- void RetrieveSavedColumnsSettingsAndUpdateTable();
+ scoped_ptr<ViewsTableDelegate> table_delegate_;
- // Stores the current values in |column_settings_| to the user prefs so that
- // it can be restored later next time the task manager view is opened.
- void StoreColumnsSettings();
-
- void ToggleColumnVisibility(int column_id);
-
- scoped_ptr<NewTaskManagerView::TableModel> table_model_;
+ scoped_ptr<TaskManagerTableModel> table_model_;
scoped_ptr<views::MenuRunner> menu_runner_;
- // Contains either the column settings retrieved from user preferences if it
- // exists, or the default column settings.
- // The columns settings are the visible columns and the last sorted column
- // and the direction of the sort.
- scoped_ptr<base::DictionaryValue> columns_settings_;
-
// We need to own the text of the menu, the Windows API does not copy it.
base::string16 always_on_top_menu_text_;

Powered by Google App Engine
This is Rietveld 408576698