| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_ |
| 6 #define CHROME_BROWSER_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_ | 6 #define CHROME_BROWSER_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include "chrome/browser/ui/gtk/options/simple_content_exceptions_window.h" |
| 10 | 10 // TODO(msw): remove this file once all includes have been updated. |
| 11 #include "app/gtk_signal.h" | |
| 12 #include "base/scoped_ptr.h" | |
| 13 #include "chrome/browser/gtk/gtk_tree.h" | |
| 14 #include "chrome/browser/remove_rows_table_model.h" | |
| 15 #include "chrome/common/content_settings.h" | |
| 16 #include "chrome/common/content_settings_types.h" | |
| 17 | |
| 18 class SimpleContentExceptionsWindow | |
| 19 : public gtk_tree::TableAdapter::Delegate { | |
| 20 public: | |
| 21 // Takes ownership of |model|. | |
| 22 static void ShowExceptionsWindow(GtkWindow* parent, | |
| 23 RemoveRowsTableModel* model, | |
| 24 int tile_message_id); | |
| 25 | |
| 26 virtual ~SimpleContentExceptionsWindow(); | |
| 27 | |
| 28 // gtk_tree::TableAdapter::Delegate implementation: | |
| 29 virtual void SetColumnValues(int row, GtkTreeIter* iter); | |
| 30 virtual void OnAnyModelUpdateStart(); | |
| 31 virtual void OnAnyModelUpdate(); | |
| 32 | |
| 33 private: | |
| 34 // Takes ownership of |model|. | |
| 35 SimpleContentExceptionsWindow(GtkWindow* parent, | |
| 36 RemoveRowsTableModel* model, | |
| 37 int title_message_id); | |
| 38 | |
| 39 // Updates which buttons are enabled. | |
| 40 void UpdateButtonState(); | |
| 41 | |
| 42 // Callbacks for the buttons. | |
| 43 CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, Remove); | |
| 44 CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, RemoveAll); | |
| 45 | |
| 46 CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, | |
| 47 OnWindowDestroy); | |
| 48 CHROMEGTK_CALLBACK_0(SimpleContentExceptionsWindow, void, | |
| 49 OnTreeSelectionChanged); | |
| 50 | |
| 51 // The list presented in |treeview_|; a gobject instead of a C++ object. | |
| 52 GtkListStore* list_store_; | |
| 53 | |
| 54 // The C++, views-ish, cross-platform model class that actually contains the | |
| 55 // gold standard data. | |
| 56 scoped_ptr<RemoveRowsTableModel> model_; | |
| 57 | |
| 58 // The adapter that ferries data back and forth between |model_| and | |
| 59 // |list_store_| whenever either of them change. | |
| 60 scoped_ptr<gtk_tree::TableAdapter> model_adapter_; | |
| 61 | |
| 62 // The exception window. | |
| 63 GtkWidget* dialog_; | |
| 64 | |
| 65 // The treeview that presents the site/action pairs. | |
| 66 GtkWidget* treeview_; | |
| 67 | |
| 68 // The current user selection from |treeview_|. | |
| 69 GtkTreeSelection* treeview_selection_; | |
| 70 | |
| 71 // Whether to ignore selection changes. This is set during model updates, | |
| 72 // when the list store may be inconsistent with the table model. | |
| 73 bool ignore_selection_changes_; | |
| 74 | |
| 75 // Buttons. | |
| 76 GtkWidget* remove_button_; | |
| 77 GtkWidget* remove_all_button_; | |
| 78 }; | |
| 79 | 11 |
| 80 #endif // CHROME_BROWSER_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_ | 12 #endif // CHROME_BROWSER_GTK_OPTIONS_SIMPLE_CONTENT_EXCEPTIONS_WINDOW_H_ |
| OLD | NEW |