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_EXCEPTION_EDITOR_H_ | 5 #ifndef CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_H_ |
6 #define CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_H_ | 6 #define CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_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 "chrome/browser/content_exceptions_table_model.h" | 13 #include "chrome/browser/content_exceptions_table_model.h" |
14 #include "chrome/browser/content_setting_combo_model.h" | 14 #include "chrome/browser/content_setting_combo_model.h" |
15 #include "chrome/common/content_settings.h" | 15 #include "chrome/common/content_settings.h" |
16 #include "chrome/common/content_settings_types.h" | 16 #include "chrome/common/content_settings_types.h" |
17 | 17 |
18 // An editor which lets the user create or edit an individual exception to the | 18 // An editor which lets the user create or edit an individual exception to the |
19 // current content setting policy. (i.e. let www.google.com always show | 19 // current content setting policy. (i.e. let www.google.com always show |
20 // images). Modal to parent. | 20 // images). Modal to parent. |
21 class ContentExceptionEditor { | 21 class ContentExceptionEditor { |
22 public: | 22 public: |
23 class Delegate { | 23 class Delegate { |
24 public: | 24 public: |
25 // Invoked when the user accepts the edit. | 25 // Invoked when the user accepts the edit. |
26 virtual void AcceptExceptionEdit( | 26 virtual void AcceptExceptionEdit( |
27 const HostContentSettingsMap::Pattern& pattern, | 27 const HostContentSettingsMap::Pattern& pattern, |
28 ContentSetting setting, | 28 ContentSetting setting, |
| 29 bool is_off_the_record, |
29 int index, | 30 int index, |
30 bool is_new) = 0; | 31 bool is_new) = 0; |
31 | 32 |
32 protected: | 33 protected: |
33 virtual ~Delegate() {} | 34 virtual ~Delegate() {} |
34 }; | 35 }; |
35 | 36 |
36 ContentExceptionEditor(GtkWindow* parent, | 37 ContentExceptionEditor(GtkWindow* parent, |
37 Delegate* delegate, | 38 Delegate* delegate, |
38 ContentExceptionsTableModel* model, | 39 ContentExceptionsTableModel* model, |
| 40 bool allow_off_the_record, |
39 int index, | 41 int index, |
40 const HostContentSettingsMap::Pattern& pattern, | 42 const HostContentSettingsMap::Pattern& pattern, |
41 ContentSetting setting); | 43 ContentSetting setting, |
| 44 bool is_off_the_record); |
42 | 45 |
43 private: | 46 private: |
44 // Returns true if we're adding a new item. | 47 // Returns true if we're adding a new item. |
45 bool is_new() const { return index_ == -1; } | 48 bool is_new() const { return index_ == -1; } |
46 | 49 |
47 bool IsPatternValid(const HostContentSettingsMap::Pattern& pattern) const; | 50 bool IsPatternValid(const HostContentSettingsMap::Pattern& pattern, |
| 51 bool is_off_the_record) const; |
48 | 52 |
49 void UpdateImage(GtkWidget* image, bool is_valid); | 53 void UpdateImage(GtkWidget* image, bool is_valid); |
50 | 54 |
51 // GTK callbacks | 55 // GTK callbacks |
52 CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnEntryChanged); | 56 CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnEntryChanged); |
53 CHROMEGTK_CALLBACK_1(ContentExceptionEditor, void, OnResponse, int); | 57 CHROMEGTK_CALLBACK_1(ContentExceptionEditor, void, OnResponse, int); |
54 CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnWindowDestroy); | 58 CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnWindowDestroy); |
55 | 59 |
56 Delegate* delegate_; | 60 Delegate* delegate_; |
57 ContentExceptionsTableModel* model_; | 61 ContentExceptionsTableModel* model_; |
58 | 62 |
59 // The model for Combobox widget. | 63 // The model for Combobox widget. |
60 ContentSettingComboModel cb_model_; | 64 ContentSettingComboModel cb_model_; |
61 | 65 |
62 // Index of the item being edited. If -1, indicates this is a new entry. | 66 // Index of the item being edited. If -1, indicates this is a new entry. |
63 const int index_; | 67 const int index_; |
64 const HostContentSettingsMap::Pattern pattern_; | 68 const HostContentSettingsMap::Pattern pattern_; |
65 const ContentSetting setting_; | 69 const ContentSetting setting_; |
66 | 70 |
67 // UI widgets. | 71 // UI widgets. |
68 GtkWidget* dialog_; | 72 GtkWidget* dialog_; |
69 GtkWidget* entry_; | 73 GtkWidget* entry_; |
70 GtkWidget* pattern_image_; | 74 GtkWidget* pattern_image_; |
71 GtkWidget* action_combo_; | 75 GtkWidget* action_combo_; |
| 76 GtkWidget* otr_checkbox_; |
72 | 77 |
73 DISALLOW_COPY_AND_ASSIGN(ContentExceptionEditor); | 78 DISALLOW_COPY_AND_ASSIGN(ContentExceptionEditor); |
74 }; | 79 }; |
75 | 80 |
76 #endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_H_ | 81 #endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_H_ |
OLD | NEW |