| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_OPTIONS_GEOLOCATION_CONTENT_EXCEPTIONS_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_ |
| 6 #define CHROME_BROWSER_GTK_OPTIONS_GEOLOCATION_CONTENT_EXCEPTIONS_WINDOW_H_ | 6 #define CHROME_BROWSER_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 | 11 |
| 12 #include "app/gtk_signal.h" | 12 #include "app/gtk_signal.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "chrome/browser/geolocation/geolocation_exceptions_table_model.h" | |
| 15 #include "chrome/browser/gtk/gtk_tree.h" | 14 #include "chrome/browser/gtk/gtk_tree.h" |
| 15 #include "chrome/browser/remove_rows_table_model.h" |
| 16 #include "chrome/common/content_settings.h" | 16 #include "chrome/common/content_settings.h" |
| 17 #include "chrome/common/content_settings_types.h" | 17 #include "chrome/common/content_settings_types.h" |
| 18 | 18 |
| 19 class GeolocationContentSettingsMap; | 19 class SimpleContentExceptionsWindow |
| 20 | |
| 21 class GeolocationContentExceptionsWindow | |
| 22 : public gtk_tree::TableAdapter::Delegate { | 20 : public gtk_tree::TableAdapter::Delegate { |
| 23 public: | 21 public: |
| 22 // Takes ownership of |model|. |
| 24 static void ShowExceptionsWindow(GtkWindow* parent, | 23 static void ShowExceptionsWindow(GtkWindow* parent, |
| 25 GeolocationContentSettingsMap* map); | 24 RemoveRowsTableModel* model); |
| 26 | 25 |
| 27 // gtk_tree::TableAdapter::Delegate implementation: | 26 // gtk_tree::TableAdapter::Delegate implementation: |
| 28 virtual void SetColumnValues(int row, GtkTreeIter* iter); | 27 virtual void SetColumnValues(int row, GtkTreeIter* iter); |
| 29 | 28 |
| 30 private: | 29 private: |
| 31 // Column ids for |list_store_|. | 30 // Column ids for |list_store_|. |
| 32 enum { | 31 enum { |
| 33 COL_HOSTNAME, | 32 COL_HOSTNAME, |
| 34 COL_ACTION, | 33 COL_ACTION, |
| 35 COL_COUNT | 34 COL_COUNT |
| 36 }; | 35 }; |
| 37 | 36 |
| 38 GeolocationContentExceptionsWindow(GtkWindow* parent, | 37 // Takes ownership of |model|. |
| 39 GeolocationContentSettingsMap* map); | 38 SimpleContentExceptionsWindow(GtkWindow* parent, |
| 39 RemoveRowsTableModel* model); |
| 40 | 40 |
| 41 // Updates which buttons are enabled. | 41 // Updates which buttons are enabled. |
| 42 void UpdateButtonState(); | 42 void UpdateButtonState(); |
| 43 | 43 |
| 44 void GetSelectedRows(GeolocationExceptionsTableModel::Rows* rows); | 44 void GetSelectedRows(RemoveRowsTableModel::Rows* rows); |
| 45 | 45 |
| 46 // Callbacks for the buttons. | 46 // Callbacks for the buttons. |
| 47 CHROMEGTK_CALLBACK_0(GeolocationContentExceptionsWindow, void, Remove); | 47 CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, Remove); |
| 48 CHROMEGTK_CALLBACK_0(GeolocationContentExceptionsWindow, void, RemoveAll); | 48 CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, RemoveAll); |
| 49 | 49 |
| 50 CHROMEGTK_CALLBACK_0(GeolocationContentExceptionsWindow, void, | 50 CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, |
| 51 OnWindowDestroy); | 51 OnWindowDestroy); |
| 52 CHROMEGTK_CALLBACK_0(GeolocationContentExceptionsWindow, void, | 52 CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, |
| 53 OnTreeSelectionChanged); | 53 OnTreeSelectionChanged); |
| 54 | 54 |
| 55 // The list presented in |treeview_|; a gobject instead of a C++ object. | 55 // The list presented in |treeview_|; a gobject instead of a C++ object. |
| 56 GtkListStore* list_store_; | 56 GtkListStore* list_store_; |
| 57 | 57 |
| 58 // The C++, views-ish, cross-platform model class that actually contains the | 58 // The C++, views-ish, cross-platform model class that actually contains the |
| 59 // gold standard data. | 59 // gold standard data. |
| 60 scoped_ptr<GeolocationExceptionsTableModel> model_; | 60 scoped_ptr<RemoveRowsTableModel> model_; |
| 61 | 61 |
| 62 // The adapter that ferries data back and forth between |model_| and | 62 // The adapter that ferries data back and forth between |model_| and |
| 63 // |list_store_| whenever either of them change. | 63 // |list_store_| whenever either of them change. |
| 64 scoped_ptr<gtk_tree::TableAdapter> model_adapter_; | 64 scoped_ptr<gtk_tree::TableAdapter> model_adapter_; |
| 65 | 65 |
| 66 // The exception window. | 66 // The exception window. |
| 67 GtkWidget* dialog_; | 67 GtkWidget* dialog_; |
| 68 | 68 |
| 69 // The treeview that presents the site/action pairs. | 69 // The treeview that presents the site/action pairs. |
| 70 GtkWidget* treeview_; | 70 GtkWidget* treeview_; |
| 71 | 71 |
| 72 // The current user selection from |treeview_|. | 72 // The current user selection from |treeview_|. |
| 73 GtkTreeSelection* treeview_selection_; | 73 GtkTreeSelection* treeview_selection_; |
| 74 | 74 |
| 75 // Buttons. | 75 // Buttons. |
| 76 GtkWidget* remove_button_; | 76 GtkWidget* remove_button_; |
| 77 GtkWidget* remove_all_button_; | 77 GtkWidget* remove_all_button_; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 #endif // CHROME_BROWSER_GTK_OPTIONS_GEOLOCATION_CONTENT_EXCEPTIONS_WINDOW_H_ | 80 #endif // CHROME_BROWSER_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_ |
| OLD | NEW |