| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_GTK_API_PERMISSIONS_PANEL_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_API_PERMISSIONS_PANEL_GTK_H_ |
| 7 |
| 8 #include <gtk/gtk.h> |
| 9 |
| 10 #include <string> |
| 11 |
| 12 #include "base/basictypes.h" |
| 13 |
| 14 |
| 15 class ApiPermissionsPanelGtk {//: public TaskManagerModelObserver { |
| 16 public: |
| 17 ApiPermissionsPanelGtk(); |
| 18 virtual ~ApiPermissionsPanelGtk(); |
| 19 |
| 20 // ApiPermissionsPanelModelObserver |
| 21 /* |
| 22 virtual void OnModelChanged(); |
| 23 virtual void OnItemsChanged(int start, int length); |
| 24 virtual void OnItemsAdded(int start, int length); |
| 25 virtual void OnItemsRemoved(int start, int length); |
| 26 */ |
| 27 |
| 28 // Creates the task manager if it doesn't exist; otherwise, it activates the |
| 29 // existing task manager window. |
| 30 static void Show(); |
| 31 |
| 32 private: |
| 33 // Initializes the task manager dialog. |
| 34 void Init(); |
| 35 |
| 36 // Set |dialog_|'s initial size, using its previous size if that was saved. |
| 37 void SetInitialDialogSize(); |
| 38 |
| 39 // Connects the ctrl-w accelerator to the dialog. |
| 40 void ConnectAccelerators(); |
| 41 |
| 42 // Sets up the treeview widget. |
| 43 void CreateApiPermissionsPanelTreeview(); |
| 44 |
| 45 // Returns the model data for a given |row| and |col_id|. |
| 46 std::string GetModelText(int row, int col_id); |
| 47 |
| 48 // Retrieves the resource icon from the model for |row|. |
| 49 GdkPixbuf* GetModelIcon(int row); |
| 50 |
| 51 // Sets the treeview row data. |row| is an index into the model and |iter| |
| 52 // is the current position in the treeview. |
| 53 void SetRowDataFromModel(int row, GtkTreeIter* iter); |
| 54 |
| 55 void ActivateFocusedTab(); |
| 56 |
| 57 // response signal handler that notifies us of dialog responses. |
| 58 static void OnResponse(GtkDialog* dialog, gint response_id, |
| 59 ApiPermissionsPanelGtk* task_manager); |
| 60 |
| 61 // changed signal handler that is sent when the treeview selection changes. |
| 62 static void OnSelectionChanged(GtkTreeSelection* selection, |
| 63 ApiPermissionsPanelGtk* task_manager); |
| 64 |
| 65 // button-press-event handler that activates a process on double-click. |
| 66 static gboolean OnButtonPressEvent(GtkWidget* widget, GdkEventButton* event, |
| 67 ApiPermissionsPanelGtk* task_manager); |
| 68 |
| 69 // button-release-event handler that opens the right-click context menu. |
| 70 static gboolean OnButtonReleaseEvent(GtkWidget* widget, GdkEventButton* event, |
| 71 ApiPermissionsPanelGtk* task_manager); |
| 72 |
| 73 // Handles an accelerator being pressed. |
| 74 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group, |
| 75 GObject* acceleratable, |
| 76 guint keyval, |
| 77 GdkModifierType modifier, |
| 78 ApiPermissionsPanelGtk* task_manager); |
| 79 |
| 80 static void ClearPermissions(gpointer data, gpointer model); |
| 81 |
| 82 // The task manager dialog window. |
| 83 GtkWidget* dialog_; |
| 84 |
| 85 // The treeview that contains the process list. |
| 86 GtkWidget* treeview_; |
| 87 |
| 88 // The list of sites. |
| 89 GtkListStore* site_list_; |
| 90 |
| 91 // The number of sites in |site_list_|. |
| 92 int site_count_; |
| 93 |
| 94 // An open task manager window. There can only be one open at a time. This |
| 95 // is reset to NULL when the window is closed. |
| 96 static ApiPermissionsPanelGtk* instance_; |
| 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(ApiPermissionsPanelGtk); |
| 99 }; |
| 100 |
| 101 #endif // CHROME_BROWSER_GTK_API_PERMISSIONS_PANEL_GTK_H_ |
| OLD | NEW |