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

Side by Side Diff: chrome/browser/ui/views/options/exceptions_view.h

Issue 6670011: Options: Remove the GTK and Views native options code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years, 9 months 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_
7 #pragma once
8
9 #include <string>
10
11 #include "chrome/browser/content_exceptions_table_model.h"
12 #include "chrome/browser/ui/views/options/exception_editor_view.h"
13 #include "chrome/common/content_settings.h"
14 #include "chrome/common/content_settings_types.h"
15 #include "views/controls/button/button.h"
16 #include "views/controls/table/table_view_observer.h"
17 #include "views/window/dialog_delegate.h"
18
19 class HostContentSettingsMap;
20
21 namespace views {
22 class NativeButton;
23 class TableView;
24 }
25
26 // ExceptionsView is responsible for showing the user the set of content
27 // exceptions for a specific type. The exceptions are shown in a table view
28 // by way of a ContentExceptionsTableModel. The user can add/edit/remove
29 // exceptions. Editing and creating new exceptions is done way of the
30 // ExceptionEditorView.
31 // Use the ShowExceptionsWindow method to create and show an ExceptionsView
32 // for a specific type. ExceptionsView is deleted when the window closes.
33 class ExceptionsView : public ExceptionEditorView::Delegate,
34 public views::View,
35 public views::ButtonListener,
36 public views::DialogDelegate,
37 public views::TableViewObserver {
38 public:
39 // Shows the Exceptions window.
40 static void ShowExceptionsWindow(gfx::NativeWindow parent,
41 HostContentSettingsMap* map,
42 HostContentSettingsMap* off_the_record_map,
43 ContentSettingsType content_type);
44
45 virtual ~ExceptionsView();
46
47 // TableViewObserver overrides:
48 virtual void OnSelectionChanged();
49 virtual void OnDoubleClick();
50 virtual void OnTableViewDelete(views::TableView* table_view);
51
52 // views::ButtonListener implementation.
53 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
54
55 // views::View overrides:
56 virtual void Layout();
57 virtual gfx::Size GetPreferredSize();
58 virtual void ViewHierarchyChanged(bool is_add,
59 views::View* parent,
60 views::View* child);
61
62 // views::WindowDelegate implementation.
63 virtual int GetDialogButtons() const {
64 return MessageBoxFlags::DIALOGBUTTON_CANCEL;
65 }
66 virtual bool CanResize() const { return true; }
67 virtual std::wstring GetWindowTitle() const;
68 virtual views::View* GetContentsView() { return this; }
69
70 // ExceptionEditorView::Delegate implementation.
71 virtual void AcceptExceptionEdit(
72 const ContentSettingsPattern& pattern,
73 ContentSetting setting,
74 bool is_off_the_record,
75 int index,
76 bool is_new);
77
78 private:
79 ExceptionsView(HostContentSettingsMap* map,
80 HostContentSettingsMap* off_the_record_map,
81 ContentSettingsType type);
82
83 void Init();
84
85 // Resets the enabled state of the buttons from the model.
86 void UpdateButtonState();
87
88 // Adds a new item.
89 void Add();
90
91 // Edits the selected item.
92 void Edit();
93
94 // Removes the selected item.
95 void Remove();
96
97 // Removes all.
98 void RemoveAll();
99
100 // The model displayed in the table.
101 ContentExceptionsTableModel model_;
102
103 // True if the user can also add incognito entries.
104 bool allow_off_the_record_;
105
106 views::TableView* table_;
107
108 views::NativeButton* add_button_;
109 views::NativeButton* edit_button_;
110 views::NativeButton* remove_button_;
111 views::NativeButton* remove_all_button_;
112
113 DISALLOW_COPY_AND_ASSIGN(ExceptionsView);
114 };
115
116 #endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_EXCEPTIONS_VIEW_H_
117
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/options/exceptions_page_view.cc ('k') | chrome/browser/ui/views/options/exceptions_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698