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 // This is the Views implementation of the collected Cookies dialog. | 5 // This is the Views implementation of the collected Cookies dialog. |
6 | 6 |
7 #ifndef CHROME_BROWSER_VIEWS_COLLECTED_COOKIES_WIN_H_ | 7 #ifndef CHROME_BROWSER_VIEWS_COLLECTED_COOKIES_WIN_H_ |
8 #define CHROME_BROWSER_VIEWS_COLLECTED_COOKIES_WIN_H_ | 8 #define CHROME_BROWSER_VIEWS_COLLECTED_COOKIES_WIN_H_ |
9 | 9 |
10 #include "chrome/browser/tab_contents/constrained_window.h" | 10 #include "chrome/browser/tab_contents/constrained_window.h" |
| 11 #include "chrome/common/content_settings.h" |
11 #include "chrome/common/notification_registrar.h" | 12 #include "chrome/common/notification_registrar.h" |
| 13 #include "views/controls/tree/tree_view.h" |
12 #include "views/window/dialog_delegate.h" | 14 #include "views/window/dialog_delegate.h" |
13 | 15 |
14 class ConstrainedWindow; | 16 class ConstrainedWindow; |
15 class CookiesTreeModel; | 17 class CookiesTreeModel; |
16 class TabContents; | 18 class TabContents; |
17 namespace views { | 19 namespace views { |
18 class Label; | 20 class Label; |
19 class TreeView; | 21 class NativeButton; |
20 } | 22 } |
21 | 23 |
22 // CollectedCookiesWin is a dialog that displays the allowed and blocked | 24 // CollectedCookiesWin is a dialog that displays the allowed and blocked |
23 // cookies of the current tab contents. To display the dialog, invoke | 25 // cookies of the current tab contents. To display the dialog, invoke |
24 // ShowCollectedCookiesDialog() on the delegate of the tab contents. | 26 // ShowCollectedCookiesDialog() on the delegate of the tab contents. |
25 | 27 |
26 class CollectedCookiesWin : public ConstrainedDialogDelegate, | 28 class CollectedCookiesWin : public ConstrainedDialogDelegate, |
27 NotificationObserver, | 29 NotificationObserver, |
| 30 views::ButtonListener, |
| 31 views::TreeViewController, |
28 views::View { | 32 views::View { |
29 public: | 33 public: |
30 // Use BrowserWindow::ShowCollectedCookiesDialog to show. | 34 // Use BrowserWindow::ShowCollectedCookiesDialog to show. |
31 CollectedCookiesWin(gfx::NativeWindow parent_window, | 35 CollectedCookiesWin(gfx::NativeWindow parent_window, |
32 TabContents* tab_contents); | 36 TabContents* tab_contents); |
33 | 37 |
34 // views::DialogDelegate implementation. | 38 // ConstrainedDialogDelegate implementation. |
35 virtual std::wstring GetWindowTitle() const; | 39 virtual std::wstring GetWindowTitle() const; |
36 virtual int GetDialogButtons() const; | 40 virtual int GetDialogButtons() const; |
37 virtual std::wstring GetDialogButtonLabel( | 41 virtual std::wstring GetDialogButtonLabel( |
38 MessageBoxFlags::DialogButton button) const; | 42 MessageBoxFlags::DialogButton button) const; |
39 virtual void DeleteDelegate(); | 43 virtual void DeleteDelegate(); |
40 | |
41 virtual bool Cancel(); | 44 virtual bool Cancel(); |
42 | |
43 // views::WindowDelegate implementation. | |
44 virtual views::View* GetContentsView(); | 45 virtual views::View* GetContentsView(); |
45 | 46 |
| 47 // views::ButtonListener implementation. |
| 48 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
| 49 |
| 50 // views::TreeViewController implementation. |
| 51 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view); |
| 52 |
46 // views::View implementation. | 53 // views::View implementation. |
47 gfx::Size GetPreferredSize(); | 54 virtual gfx::Size GetPreferredSize(); |
48 | 55 |
49 private: | 56 private: |
50 virtual ~CollectedCookiesWin(); | 57 virtual ~CollectedCookiesWin(); |
51 | 58 |
52 void Init(); | 59 void Init(); |
53 | 60 |
| 61 void EnableControls(); |
| 62 |
| 63 void AddContentException(views::TreeView* tree_view, ContentSetting setting); |
| 64 |
54 // Notification Observer implementation. | 65 // Notification Observer implementation. |
55 void Observe(NotificationType type, | 66 void Observe(NotificationType type, |
56 const NotificationSource& source, | 67 const NotificationSource& source, |
57 const NotificationDetails& details); | 68 const NotificationDetails& details); |
58 | 69 |
59 NotificationRegistrar registrar_; | 70 NotificationRegistrar registrar_; |
60 | 71 |
61 ConstrainedWindow* window_; | 72 ConstrainedWindow* window_; |
62 | 73 |
63 // The tab contents. | 74 // The tab contents. |
64 TabContents* tab_contents_; | 75 TabContents* tab_contents_; |
65 | 76 |
66 // Assorted views. | 77 // Assorted views. |
67 views::Label* allowed_label_; | 78 views::Label* allowed_label_; |
68 views::Label* blocked_label_; | 79 views::Label* blocked_label_; |
69 | 80 |
70 views::TreeView* allowed_cookies_tree_; | 81 views::TreeView* allowed_cookies_tree_; |
71 views::TreeView* blocked_cookies_tree_; | 82 views::TreeView* blocked_cookies_tree_; |
72 | 83 |
| 84 views::NativeButton* block_allowed_button_; |
| 85 views::NativeButton* allow_blocked_button_; |
| 86 views::NativeButton* for_session_blocked_button_; |
| 87 |
73 scoped_ptr<CookiesTreeModel> allowed_cookies_tree_model_; | 88 scoped_ptr<CookiesTreeModel> allowed_cookies_tree_model_; |
74 scoped_ptr<CookiesTreeModel> blocked_cookies_tree_model_; | 89 scoped_ptr<CookiesTreeModel> blocked_cookies_tree_model_; |
75 | 90 |
76 DISALLOW_COPY_AND_ASSIGN(CollectedCookiesWin); | 91 DISALLOW_COPY_AND_ASSIGN(CollectedCookiesWin); |
77 }; | 92 }; |
78 | 93 |
79 #endif // CHROME_BROWSER_VIEWS_COLLECTED_COOKIES_WIN_H_ | 94 #endif // CHROME_BROWSER_VIEWS_COLLECTED_COOKIES_WIN_H_ |
OLD | NEW |