| 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_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 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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::Textfield::Controller, |
| 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 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 int index, | 44 int index, |
| 45 bool is_new) = 0; | 45 bool is_new) = 0; |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 virtual ~Delegate() {} | 48 virtual ~Delegate() {} |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // Creates a new ExceptionEditorView with the supplied args. |index| is the | 51 // Creates a new ExceptionEditorView with the supplied args. |index| is the |
| 52 // index into the ContentExceptionsTableModel of the exception. This is not | 52 // index into the ContentExceptionsTableModel of the exception. This is not |
| 53 // used by ExceptionEditorView but instead passed to the delegate. | 53 // used by ExceptionEditorView but instead passed to the delegate. |
| 54 ExceptionEditorView(Delegate* delegate, | 54 ExceptionEditorView(Delegate* delegate, |
| 55 ContentExceptionsTableModel* model, | 55 ContentExceptionsTableModel* model, |
| 56 bool allow_off_the_record, | 56 bool allow_off_the_record, |
| 57 int index, | 57 int index, |
| 58 const HostContentSettingsMap::Pattern& pattern, | 58 const ContentSettingsPattern& pattern, |
| 59 ContentSetting setting, | 59 ContentSetting setting, |
| 60 bool is_off_the_record); | 60 bool is_off_the_record); |
| 61 virtual ~ExceptionEditorView() {} | 61 virtual ~ExceptionEditorView() {} |
| 62 | 62 |
| 63 void Show(gfx::NativeWindow parent); | 63 void Show(gfx::NativeWindow parent); |
| 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( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 80 const views::Textfield::Keystroke& key); | 80 const views::Textfield::Keystroke& key); |
| 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 |
| 87 // Returns true if we're adding a new item. | 87 // Returns true if we're adding a new item. |
| 88 bool is_new() const { return index_ == -1; } | 88 bool is_new() const { return index_ == -1; } |
| 89 | 89 |
| 90 bool IsPatternValid(const HostContentSettingsMap::Pattern& pattern, | 90 bool IsPatternValid(const ContentSettingsPattern& pattern, |
| 91 bool is_off_the_record) const; | 91 bool is_off_the_record) const; |
| 92 | 92 |
| 93 void UpdateImageView(views::ImageView* image_view, bool is_valid); | 93 void UpdateImageView(views::ImageView* image_view, bool is_valid); |
| 94 | 94 |
| 95 Delegate* delegate_; | 95 Delegate* delegate_; |
| 96 ContentExceptionsTableModel* model_; | 96 ContentExceptionsTableModel* model_; |
| 97 ContentSettingComboModel cb_model_; | 97 ContentSettingComboModel cb_model_; |
| 98 | 98 |
| 99 // Index of the item being edited. If -1, indices this is a new entry. | 99 // Index of the item being edited. If -1, indices this is a new entry. |
| 100 const bool allow_off_the_record_; | 100 const bool allow_off_the_record_; |
| 101 const int index_; | 101 const int index_; |
| 102 const HostContentSettingsMap::Pattern pattern_; | 102 const ContentSettingsPattern pattern_; |
| 103 const ContentSetting setting_; | 103 const ContentSetting setting_; |
| 104 const bool is_off_the_record_; | 104 const bool is_off_the_record_; |
| 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 |