| 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_EXCEPTIONS_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/content_exceptions_table_model.h" | 10 #include "chrome/browser/content_exceptions_table_model.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // for a specific type. ExceptionsView is deleted when the window closes. | 31 // for a specific type. ExceptionsView is deleted when the window closes. |
| 32 class ExceptionsView : public ExceptionEditorView::Delegate, | 32 class ExceptionsView : public ExceptionEditorView::Delegate, |
| 33 public views::View, | 33 public views::View, |
| 34 public views::ButtonListener, | 34 public views::ButtonListener, |
| 35 public views::DialogDelegate, | 35 public views::DialogDelegate, |
| 36 public views::TableViewObserver { | 36 public views::TableViewObserver { |
| 37 public: | 37 public: |
| 38 // Shows the Exceptions window. | 38 // Shows the Exceptions window. |
| 39 static void ShowExceptionsWindow(gfx::NativeWindow parent, | 39 static void ShowExceptionsWindow(gfx::NativeWindow parent, |
| 40 HostContentSettingsMap* map, | 40 HostContentSettingsMap* map, |
| 41 HostContentSettingsMap* off_the_record_map, |
| 41 ContentSettingsType content_type); | 42 ContentSettingsType content_type); |
| 42 | 43 |
| 43 virtual ~ExceptionsView(); | 44 virtual ~ExceptionsView(); |
| 44 | 45 |
| 45 // TableViewObserver overrides: | 46 // TableViewObserver overrides: |
| 46 virtual void OnSelectionChanged(); | 47 virtual void OnSelectionChanged(); |
| 47 virtual void OnDoubleClick(); | 48 virtual void OnDoubleClick(); |
| 48 virtual void OnTableViewDelete(views::TableView* table_view); | 49 virtual void OnTableViewDelete(views::TableView* table_view); |
| 49 | 50 |
| 50 // views::ButtonListener implementation. | 51 // views::ButtonListener implementation. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 62 return MessageBoxFlags::DIALOGBUTTON_CANCEL; | 63 return MessageBoxFlags::DIALOGBUTTON_CANCEL; |
| 63 } | 64 } |
| 64 virtual bool CanResize() const { return true; } | 65 virtual bool CanResize() const { return true; } |
| 65 virtual std::wstring GetWindowTitle() const; | 66 virtual std::wstring GetWindowTitle() const; |
| 66 virtual views::View* GetContentsView() { return this; } | 67 virtual views::View* GetContentsView() { return this; } |
| 67 | 68 |
| 68 // ExceptionEditorView::Delegate implementation. | 69 // ExceptionEditorView::Delegate implementation. |
| 69 virtual void AcceptExceptionEdit( | 70 virtual void AcceptExceptionEdit( |
| 70 const HostContentSettingsMap::Pattern& pattern, | 71 const HostContentSettingsMap::Pattern& pattern, |
| 71 ContentSetting setting, | 72 ContentSetting setting, |
| 73 bool is_off_the_record, |
| 72 int index, | 74 int index, |
| 73 bool is_new); | 75 bool is_new); |
| 74 | 76 |
| 75 private: | 77 private: |
| 76 ExceptionsView(HostContentSettingsMap* map, ContentSettingsType type); | 78 ExceptionsView(HostContentSettingsMap* map, |
| 79 HostContentSettingsMap* off_the_record_map, |
| 80 ContentSettingsType type); |
| 77 | 81 |
| 78 void Init(); | 82 void Init(); |
| 79 | 83 |
| 80 // Resets the enabled state of the buttons from the model. | 84 // Resets the enabled state of the buttons from the model. |
| 81 void UpdateButtonState(); | 85 void UpdateButtonState(); |
| 82 | 86 |
| 83 // Adds a new item. | 87 // Adds a new item. |
| 84 void Add(); | 88 void Add(); |
| 85 | 89 |
| 86 // Edits the selected item. | 90 // Edits the selected item. |
| 87 void Edit(); | 91 void Edit(); |
| 88 | 92 |
| 89 // Removes the selected item. | 93 // Removes the selected item. |
| 90 void Remove(); | 94 void Remove(); |
| 91 | 95 |
| 92 // Removes all. | 96 // Removes all. |
| 93 void RemoveAll(); | 97 void RemoveAll(); |
| 94 | 98 |
| 95 // The model displayed in the table. | 99 // The model displayed in the table. |
| 96 ContentExceptionsTableModel model_; | 100 ContentExceptionsTableModel model_; |
| 97 | 101 |
| 102 // True if the user can also add off the record entries. |
| 103 bool allow_off_the_record_; |
| 104 |
| 98 views::TableView* table_; | 105 views::TableView* table_; |
| 99 | 106 |
| 100 views::NativeButton* add_button_; | 107 views::NativeButton* add_button_; |
| 101 views::NativeButton* edit_button_; | 108 views::NativeButton* edit_button_; |
| 102 views::NativeButton* remove_button_; | 109 views::NativeButton* remove_button_; |
| 103 views::NativeButton* remove_all_button_; | 110 views::NativeButton* remove_all_button_; |
| 104 | 111 |
| 105 DISALLOW_COPY_AND_ASSIGN(ExceptionsView); | 112 DISALLOW_COPY_AND_ASSIGN(ExceptionsView); |
| 106 }; | 113 }; |
| 107 | 114 |
| 108 #endif // CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_ | 115 #endif // CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_ |
| 109 | 116 |
| OLD | NEW |