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_UI_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
| 11 #include "chrome/browser/content_setting_combo_model.h" |
11 #include "chrome/browser/content_settings/host_content_settings_map.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map.h" |
12 #include "chrome/browser/content_setting_combo_model.h" | |
13 #include "chrome/common/content_settings.h" | 13 #include "chrome/common/content_settings.h" |
14 #include "chrome/common/content_settings_types.h" | 14 #include "chrome/common/content_settings_types.h" |
15 #include "views/window/dialog_delegate.h" | |
16 #include "views/controls/button/checkbox.h" | 15 #include "views/controls/button/checkbox.h" |
17 #include "views/controls/combobox/combobox.h" | 16 #include "views/controls/combobox/combobox.h" |
18 #include "views/controls/textfield/textfield.h" | 17 #include "views/controls/textfield/textfield_controller.h" |
| 18 #include "views/window/dialog_delegate.h" |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 class ImageView; | 21 class ImageView; |
22 class Label; | 22 class Label; |
23 } | 23 } |
24 | 24 |
25 class ContentExceptionsTableModel; | 25 class ContentExceptionsTableModel; |
26 | 26 |
27 // ExceptionEditorView is responsible for showing a dialog that allows the user | 27 // ExceptionEditorView is responsible for showing a dialog that allows the user |
28 // to create or edit a single content exception. If the user clicks ok the | 28 // to create or edit a single content exception. If the user clicks ok the |
29 // delegate is notified and completes the edit. | 29 // delegate is notified and completes the edit. |
30 // | 30 // |
31 // To use an ExceptionEditorView create one and invoke Show on it. | 31 // To use an ExceptionEditorView create one and invoke Show on it. |
32 // ExceptionEditorView is deleted when the dialog closes. | 32 // ExceptionEditorView is deleted when the dialog closes. |
33 class ExceptionEditorView : public views::View, | 33 class ExceptionEditorView : public views::View, |
34 public views::Textfield::Controller, | 34 public views::TextfieldController, |
35 public views::DialogDelegate { | 35 public views::DialogDelegate { |
36 public: | 36 public: |
37 class Delegate { | 37 class Delegate { |
38 public: | 38 public: |
39 // Invoked when the user accepts the edit. | 39 // Invoked when the user accepts the edit. |
40 virtual void AcceptExceptionEdit( | 40 virtual void AcceptExceptionEdit( |
41 const ContentSettingsPattern& pattern, | 41 const ContentSettingsPattern& pattern, |
42 ContentSetting setting, | 42 ContentSetting setting, |
43 bool is_off_the_record, | 43 bool is_off_the_record, |
44 int index, | 44 int index, |
(...skipping 19 matching lines...) Expand all Loading... |
64 | 64 |
65 // views::DialogDelegate overrides. | 65 // views::DialogDelegate overrides. |
66 virtual bool IsModal() const; | 66 virtual bool IsModal() const; |
67 virtual std::wstring GetWindowTitle() const; | 67 virtual std::wstring GetWindowTitle() const; |
68 virtual bool IsDialogButtonEnabled( | 68 virtual bool IsDialogButtonEnabled( |
69 MessageBoxFlags::DialogButton button) const; | 69 MessageBoxFlags::DialogButton button) const; |
70 virtual bool Cancel(); | 70 virtual bool Cancel(); |
71 virtual bool Accept(); | 71 virtual bool Accept(); |
72 virtual views::View* GetContentsView(); | 72 virtual views::View* GetContentsView(); |
73 | 73 |
74 // views::Textfield::Controller overrides. Updates whether the user can | 74 // views::TextfieldController: |
75 // accept the dialog as well as updating image views showing whether value is | 75 // Updates whether the user can accept the dialog as well as updating image |
76 // valid. | 76 // views showing whether value is valid. |
77 virtual void ContentsChanged(views::Textfield* sender, | 77 virtual void ContentsChanged(views::Textfield* sender, |
78 const std::wstring& new_contents); | 78 const std::wstring& new_contents); |
79 virtual bool HandleKeyEvent(views::Textfield* sender, | 79 virtual bool HandleKeyEvent(views::Textfield* sender, |
80 const views::KeyEvent& key_event); | 80 const views::KeyEvent& key_event); |
81 | 81 |
82 private: | 82 private: |
83 void Init(); | 83 void Init(); |
84 | 84 |
85 views::Label* CreateLabel(int message_id); | 85 views::Label* CreateLabel(int message_id); |
86 | 86 |
(...skipping 18 matching lines...) Expand all Loading... |
105 | 105 |
106 views::Textfield* pattern_tf_; | 106 views::Textfield* pattern_tf_; |
107 views::ImageView* pattern_iv_; | 107 views::ImageView* pattern_iv_; |
108 views::Combobox* action_cb_; | 108 views::Combobox* action_cb_; |
109 views::Checkbox* incognito_cb_; | 109 views::Checkbox* incognito_cb_; |
110 | 110 |
111 DISALLOW_COPY_AND_ASSIGN(ExceptionEditorView); | 111 DISALLOW_COPY_AND_ASSIGN(ExceptionEditorView); |
112 }; | 112 }; |
113 | 113 |
114 #endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ | 114 #endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTION_EDITOR_VIEW_H_ |
OLD | NEW |