| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_GTK_TASK_MANAGER_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ | 6 #define CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> |
| 9 |
| 10 #include <string> |
| 11 |
| 8 #include "chrome/browser/task_manager.h" | 12 #include "chrome/browser/task_manager.h" |
| 9 | 13 |
| 10 class TaskManagerGtk : public TaskManagerModelObserver { | 14 class TaskManagerGtk : public TaskManagerModelObserver { |
| 11 public: | 15 public: |
| 12 TaskManagerGtk(); | 16 TaskManagerGtk(); |
| 13 virtual ~TaskManagerGtk(); | 17 virtual ~TaskManagerGtk(); |
| 14 | 18 |
| 15 // TaskManagerModelObserver | 19 // TaskManagerModelObserver |
| 16 virtual void OnModelChanged(); | 20 virtual void OnModelChanged(); |
| 17 virtual void OnItemsChanged(int start, int length); | 21 virtual void OnItemsChanged(int start, int length); |
| 18 virtual void OnItemsAdded(int start, int length); | 22 virtual void OnItemsAdded(int start, int length); |
| 19 virtual void OnItemsRemoved(int start, int length); | 23 virtual void OnItemsRemoved(int start, int length); |
| 20 | 24 |
| 21 void Init(); | |
| 22 | |
| 23 // response signal handler that notifies us of dialog responses. | |
| 24 static void OnResponse(GtkDialog* dialog, gint response_id, | |
| 25 TaskManagerGtk* task_manager); | |
| 26 | |
| 27 // Creates the task manager if it doesn't exist; otherwise, it activates the | 25 // Creates the task manager if it doesn't exist; otherwise, it activates the |
| 28 // existing task manager window. | 26 // existing task manager window. |
| 29 static void Show(); | 27 static void Show(); |
| 30 | 28 |
| 31 private: | 29 private: |
| 30 // Initializes the task manager dialog. |
| 31 void Init(); |
| 32 |
| 33 // Sets up the treeview widget. |
| 34 void CreateTaskManagerTreeview(); |
| 35 |
| 36 // Returns the model data for a given |row| and |col_id|. |
| 37 std::string GetModelText(int row, int col_id); |
| 38 |
| 39 // Sets the treeview row data. |row| is an index into the model and |iter| |
| 40 // is the current position in the treeview. |
| 41 void SetRowDataFromModel(int row, GtkTreeIter* iter); |
| 42 |
| 43 // Queries the treeview for the selected rows, and kills those processes. |
| 44 void KillSelectedProcesses(); |
| 45 |
| 46 // response signal handler that notifies us of dialog responses. |
| 47 static void OnResponse(GtkDialog* dialog, gint response_id, |
| 48 TaskManagerGtk* task_manager); |
| 49 |
| 50 // changed signal handler that is sent when the treeview selection changes. |
| 51 static void OnSelectionChanged(GtkTreeSelection* selection, |
| 52 TaskManagerGtk* task_manager); |
| 53 |
| 32 // The task manager. | 54 // The task manager. |
| 33 TaskManager* task_manager_; | 55 TaskManager* task_manager_; |
| 34 | 56 |
| 35 // Our model. | 57 // Our model. |
| 36 TaskManagerModel* model_; | 58 TaskManagerModel* model_; |
| 37 | 59 |
| 38 // The task manager dialog window. | 60 // The task manager dialog window. |
| 39 GtkWidget* dialog_; | 61 GtkWidget* dialog_; |
| 40 | 62 |
| 41 // The treeview that contains the process list. | 63 // The treeview that contains the process list. |
| 42 GtkWidget* treeview_; | 64 GtkWidget* treeview_; |
| 43 | 65 |
| 66 // The list of processes. |
| 67 GtkListStore* process_list_; |
| 68 |
| 69 // The number of processes in |process_list_|. |
| 70 int process_count_; |
| 71 |
| 44 // An open task manager window. There can only be one open at a time. This | 72 // An open task manager window. There can only be one open at a time. This |
| 45 // is reset to NULL when the window is closed. | 73 // is reset to NULL when the window is closed. |
| 46 static TaskManagerGtk* instance_; | 74 static TaskManagerGtk* instance_; |
| 47 | 75 |
| 48 DISALLOW_COPY_AND_ASSIGN(TaskManagerGtk); | 76 DISALLOW_COPY_AND_ASSIGN(TaskManagerGtk); |
| 49 }; | 77 }; |
| 50 | 78 |
| 51 #endif // CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ | 79 #endif // CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ |
| OLD | NEW |