Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: chrome/browser/gtk/options/content_exception_editor.h

Issue 5574001: Move ContentSettingsDetails and Pattern out of HostContentSettingsMap as separate classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/content_settings
Patch Set: updates Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
11 #include "app/gtk_signal.h" 11 #include "app/gtk_signal.h"
12 #include "chrome/browser/content_exceptions_table_model.h" 12 #include "chrome/browser/content_exceptions_table_model.h"
13 #include "chrome/browser/content_setting_combo_model.h" 13 #include "chrome/browser/content_setting_combo_model.h"
14 #include "chrome/common/content_settings.h" 14 #include "chrome/common/content_settings.h"
15 #include "chrome/common/content_settings_types.h" 15 #include "chrome/common/content_settings_types.h"
16 16
17 // An editor which lets the user create or edit an individual exception to the 17 // An editor which lets the user create or edit an individual exception to the
18 // current content setting policy. (i.e. let www.google.com always show 18 // current content setting policy. (i.e. let www.google.com always show
19 // images). Modal to parent. 19 // images). Modal to parent.
20 class ContentExceptionEditor { 20 class ContentExceptionEditor {
21 public: 21 public:
22 class Delegate { 22 class Delegate {
23 public: 23 public:
24 // Invoked when the user accepts the edit. 24 // Invoked when the user accepts the edit.
25 virtual void AcceptExceptionEdit( 25 virtual void AcceptExceptionEdit(
26 const HostContentSettingsMap::Pattern& pattern, 26 const ContentSettingsPattern& pattern,
27 ContentSetting setting, 27 ContentSetting setting,
28 bool is_off_the_record, 28 bool is_off_the_record,
29 int index, 29 int index,
30 bool is_new) = 0; 30 bool is_new) = 0;
31 31
32 protected: 32 protected:
33 virtual ~Delegate() {} 33 virtual ~Delegate() {}
34 }; 34 };
35 35
36 ContentExceptionEditor(GtkWindow* parent, 36 ContentExceptionEditor(GtkWindow* parent,
37 Delegate* delegate, 37 Delegate* delegate,
38 ContentExceptionsTableModel* model, 38 ContentExceptionsTableModel* model,
39 bool allow_off_the_record, 39 bool allow_off_the_record,
40 int index, 40 int index,
41 const HostContentSettingsMap::Pattern& pattern, 41 const ContentSettingsPattern& pattern,
42 ContentSetting setting, 42 ContentSetting setting,
43 bool is_off_the_record); 43 bool is_off_the_record);
44 virtual ~ContentExceptionEditor() {} 44 virtual ~ContentExceptionEditor() {}
45 45
46 private: 46 private:
47 // Returns true if we're adding a new item. 47 // Returns true if we're adding a new item.
48 bool is_new() const { return index_ == -1; } 48 bool is_new() const { return index_ == -1; }
49 49
50 bool IsPatternValid(const HostContentSettingsMap::Pattern& pattern, 50 bool IsPatternValid(const ContentSettingsPattern& pattern,
51 bool is_off_the_record) const; 51 bool is_off_the_record) const;
52 52
53 void UpdateImage(GtkWidget* image, bool is_valid); 53 void UpdateImage(GtkWidget* image, bool is_valid);
54 54
55 // GTK callbacks 55 // GTK callbacks
56 CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnEntryChanged); 56 CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnEntryChanged);
57 CHROMEGTK_CALLBACK_1(ContentExceptionEditor, void, OnResponse, int); 57 CHROMEGTK_CALLBACK_1(ContentExceptionEditor, void, OnResponse, int);
58 CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnWindowDestroy); 58 CHROMEGTK_CALLBACK_0(ContentExceptionEditor, void, OnWindowDestroy);
59 59
60 Delegate* delegate_; 60 Delegate* delegate_;
61 ContentExceptionsTableModel* model_; 61 ContentExceptionsTableModel* model_;
62 62
63 // The model for Combobox widget. 63 // The model for Combobox widget.
64 ContentSettingComboModel cb_model_; 64 ContentSettingComboModel cb_model_;
65 65
66 // 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.
67 const int index_; 67 const int index_;
68 const HostContentSettingsMap::Pattern pattern_; 68 const ContentSettingsPattern pattern_;
69 const ContentSetting setting_; 69 const ContentSetting setting_;
70 70
71 // UI widgets. 71 // UI widgets.
72 GtkWidget* dialog_; 72 GtkWidget* dialog_;
73 GtkWidget* entry_; 73 GtkWidget* entry_;
74 GtkWidget* pattern_image_; 74 GtkWidget* pattern_image_;
75 GtkWidget* action_combo_; 75 GtkWidget* action_combo_;
76 GtkWidget* otr_checkbox_; 76 GtkWidget* otr_checkbox_;
77 77
78 DISALLOW_COPY_AND_ASSIGN(ContentExceptionEditor); 78 DISALLOW_COPY_AND_ASSIGN(ContentExceptionEditor);
79 }; 79 };
80 80
81 #endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_H_ 81 #endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_EXCEPTION_EDITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698