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_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ |
6 #define CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "app/combobox_model.h" | 10 #include "app/combobox_model.h" |
11 #include "chrome/common/content_settings.h" | 11 #include "chrome/common/content_settings.h" |
12 #include "chrome/common/content_settings_types.h" | 12 #include "chrome/common/content_settings_types.h" |
13 #include "views/window/dialog_delegate.h" | 13 #include "views/window/dialog_delegate.h" |
14 #include "views/controls/combobox/combobox.h" | 14 #include "views/controls/combobox/combobox.h" |
15 #include "views/controls/textfield/textfield.h" | 15 #include "views/controls/textfield/textfield.h" |
16 | 16 |
17 namespace views { | 17 namespace views { |
| 18 class ImageView; |
18 class Label; | 19 class Label; |
19 } | 20 } |
20 | 21 |
21 class ContentExceptionsTableModel; | 22 class ContentExceptionsTableModel; |
22 | 23 |
23 // ExceptionEditorView is responsible for showing a dialog that allows the user | 24 // ExceptionEditorView is responsible for showing a dialog that allows the user |
24 // to create or edit a single content exception. If the user clicks ok the | 25 // to create or edit a single content exception. If the user clicks ok the |
25 // delegate is notified and completes the edit. | 26 // delegate is notified and completes the edit. |
26 // | 27 // |
27 // To use an ExceptionEditorView create one and invoke Show on it. | 28 // To use an ExceptionEditorView create one and invoke Show on it. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 DISALLOW_COPY_AND_ASSIGN(ActionComboboxModel); | 90 DISALLOW_COPY_AND_ASSIGN(ActionComboboxModel); |
90 }; | 91 }; |
91 | 92 |
92 void Init(); | 93 void Init(); |
93 | 94 |
94 views::Label* CreateLabel(int message_id); | 95 views::Label* CreateLabel(int message_id); |
95 | 96 |
96 // Returns true if we're adding a new item. | 97 // Returns true if we're adding a new item. |
97 bool is_new() const { return index_ == -1; } | 98 bool is_new() const { return index_ == -1; } |
98 | 99 |
| 100 bool IsHostValid(const std::string& host) const; |
| 101 |
| 102 void UpdateImageView(views::ImageView* image_view, bool is_valid); |
| 103 |
99 Delegate* delegate_; | 104 Delegate* delegate_; |
100 ContentExceptionsTableModel* model_; | 105 ContentExceptionsTableModel* model_; |
101 ActionComboboxModel cb_model_; | 106 ActionComboboxModel cb_model_; |
102 | 107 |
103 // Index of the item being edited. If -1, indices this is a new entry. | 108 // Index of the item being edited. If -1, indices this is a new entry. |
104 const int index_; | 109 const int index_; |
105 const std::string host_; | 110 const std::string host_; |
106 const ContentSetting setting_; | 111 const ContentSetting setting_; |
107 | 112 |
108 views::Textfield* host_tf_; | 113 views::Textfield* host_tf_; |
| 114 views::ImageView* host_iv_; |
109 views::Combobox* action_cb_; | 115 views::Combobox* action_cb_; |
110 | 116 |
111 DISALLOW_COPY_AND_ASSIGN(ExceptionEditorView); | 117 DISALLOW_COPY_AND_ASSIGN(ExceptionEditorView); |
112 }; | 118 }; |
113 | 119 |
114 #endif // CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ | 120 #endif // CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ |
OLD | NEW |