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_CONTENT_EXCEPTIONS_WINDOW_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTIONS_WINDOW_GTK_H_ |
6 #define CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTIONS_WINDOW_GTK_H_ | 6 #define CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTIONS_WINDOW_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
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/content_exceptions_table_model.h" | 14 #include "chrome/browser/content_exceptions_table_model.h" |
15 #include "chrome/browser/gtk/gtk_tree.h" | 15 #include "chrome/browser/gtk/gtk_tree.h" |
16 #include "chrome/browser/gtk/options/content_exception_editor.h" | 16 #include "chrome/browser/gtk/options/content_exception_editor.h" |
17 #include "chrome/common/content_settings.h" | 17 #include "chrome/common/content_settings.h" |
18 #include "chrome/common/content_settings_types.h" | 18 #include "chrome/common/content_settings_types.h" |
19 | 19 |
20 class HostContentSettingsMap; | 20 class HostContentSettingsMap; |
21 | 21 |
22 // Dialog that lists each of the exceptions to the current content policy, and | 22 // Dialog that lists each of the exceptions to the current content policy, and |
23 // has options for adding/editing/removing entries. Modal to parrent. | 23 // has options for adding/editing/removing entries. Modal to parrent. |
24 class ContentExceptionsWindowGtk : public gtk_tree::TableAdapter::Delegate, | 24 class ContentExceptionsWindowGtk : public gtk_tree::TableAdapter::Delegate, |
25 public ContentExceptionEditor::Delegate { | 25 public ContentExceptionEditor::Delegate { |
26 public: | 26 public: |
27 static void ShowExceptionsWindow(GtkWindow* window, | 27 static void ShowExceptionsWindow(GtkWindow* window, |
28 HostContentSettingsMap* map, | 28 HostContentSettingsMap* map, |
| 29 HostContentSettingsMap* off_the_record_map, |
29 ContentSettingsType content_type); | 30 ContentSettingsType content_type); |
30 | 31 |
31 ~ContentExceptionsWindowGtk(); | 32 ~ContentExceptionsWindowGtk(); |
32 | 33 |
33 // gtk_tree::TableAdapter::Delegate implementation: | 34 // gtk_tree::TableAdapter::Delegate implementation: |
34 virtual void SetColumnValues(int row, GtkTreeIter* iter); | 35 virtual void SetColumnValues(int row, GtkTreeIter* iter); |
35 | 36 |
36 // ContentExceptionEditor::Delegate implementation: | 37 // ContentExceptionEditor::Delegate implementation: |
37 virtual void AcceptExceptionEdit( | 38 virtual void AcceptExceptionEdit( |
38 const HostContentSettingsMap::Pattern& pattern, | 39 const HostContentSettingsMap::Pattern& pattern, |
39 ContentSetting setting, | 40 ContentSetting setting, |
| 41 bool is_off_the_record, |
40 int index, | 42 int index, |
41 bool is_new); | 43 bool is_new); |
42 | 44 |
43 private: | 45 private: |
44 // Column ids for |list_store_|. | 46 // Column ids for |list_store_|. |
45 enum { | 47 enum { |
46 COL_PATTERN, | 48 COL_PATTERN, |
47 COL_ACTION, | 49 COL_ACTION, |
| 50 COL_OTR, |
48 COL_COUNT | 51 COL_COUNT |
49 }; | 52 }; |
50 | 53 |
51 ContentExceptionsWindowGtk(GtkWindow* parent, | 54 ContentExceptionsWindowGtk(GtkWindow* parent, |
52 HostContentSettingsMap* map, | 55 HostContentSettingsMap* map, |
| 56 HostContentSettingsMap* off_the_record_map, |
53 ContentSettingsType type); | 57 ContentSettingsType type); |
54 | 58 |
55 // Updates which buttons are enabled. | 59 // Updates which buttons are enabled. |
56 void UpdateButtonState(); | 60 void UpdateButtonState(); |
57 | 61 |
58 // Callbacks for the buttons. | 62 // Callbacks for the buttons. |
59 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Add); | 63 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Add); |
60 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Edit); | 64 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Edit); |
61 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Remove); | 65 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, Remove); |
62 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, RemoveAll); | 66 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, RemoveAll); |
63 | 67 |
64 // Returns the title of the window (changes based on what ContentSettingsType | 68 // Returns the title of the window (changes based on what ContentSettingsType |
65 // was set to in the constructor). | 69 // was set to in the constructor). |
66 std::string GetWindowTitle() const; | 70 std::string GetWindowTitle() const; |
67 | 71 |
68 // GTK Callbacks | 72 // GTK Callbacks |
69 CHROMEGTK_CALLBACK_2(ContentExceptionsWindowGtk, void, | 73 CHROMEGTK_CALLBACK_2(ContentExceptionsWindowGtk, void, |
70 OnTreeViewRowActivate, GtkTreePath*, GtkTreeViewColumn*); | 74 OnTreeViewRowActivate, GtkTreePath*, GtkTreeViewColumn*); |
71 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, OnWindowDestroy); | 75 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, OnWindowDestroy); |
72 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, | 76 CHROMEGTK_CALLBACK_0(ContentExceptionsWindowGtk, void, |
73 OnTreeSelectionChanged); | 77 OnTreeSelectionChanged); |
74 | 78 |
75 // The list presented in |treeview_|; a gobject instead of a C++ object. | 79 // The list presented in |treeview_|; a gobject instead of a C++ object. |
76 GtkListStore* list_store_; | 80 GtkListStore* list_store_; |
77 | 81 |
78 // The C++, views-ish, cross-platform model class that actually contains the | 82 // The C++, views-ish, cross-platform model class that actually contains the |
79 // gold standard data. | 83 // gold standard data. |
80 scoped_ptr<ContentExceptionsTableModel> model_; | 84 scoped_ptr<ContentExceptionsTableModel> model_; |
81 | 85 |
| 86 // True if we also show exceptions from an OTR profile. |
| 87 bool allow_off_the_record_; |
| 88 |
82 // The adapter that ferries data back and forth between |model_| and | 89 // The adapter that ferries data back and forth between |model_| and |
83 // |list_store_| whenever either of them change. | 90 // |list_store_| whenever either of them change. |
84 scoped_ptr<gtk_tree::TableAdapter> model_adapter_; | 91 scoped_ptr<gtk_tree::TableAdapter> model_adapter_; |
85 | 92 |
86 // The exception window. | 93 // The exception window. |
87 GtkWidget* dialog_; | 94 GtkWidget* dialog_; |
88 | 95 |
89 // The treeview that presents the site/action pairs. | 96 // The treeview that presents the site/action pairs. |
90 GtkWidget* treeview_; | 97 GtkWidget* treeview_; |
91 | 98 |
92 // The current user selection from |treeview_|. | 99 // The current user selection from |treeview_|. |
93 GtkTreeSelection* treeview_selection_; | 100 GtkTreeSelection* treeview_selection_; |
94 | 101 |
95 // Buttons. | 102 // Buttons. |
96 GtkWidget* edit_button_; | 103 GtkWidget* edit_button_; |
97 GtkWidget* remove_button_; | 104 GtkWidget* remove_button_; |
98 GtkWidget* remove_all_button_; | 105 GtkWidget* remove_all_button_; |
99 }; | 106 }; |
100 | 107 |
101 #endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTIONS_WINDOW_GTK_H_ | 108 #endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTIONS_WINDOW_GTK_H_ |
OLD | NEW |