| 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 // This is the Gtk implementation of the collected Cookies dialog. | |
| 6 | |
| 7 #ifndef CHROME_BROWSER_GTK_COLLECTED_COOKIES_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_COLLECTED_COOKIES_GTK_H_ |
| 8 #define CHROME_BROWSER_GTK_COLLECTED_COOKIES_GTK_H_ | 6 #define CHROME_BROWSER_GTK_COLLECTED_COOKIES_GTK_H_ |
| 9 #pragma once | 7 #pragma once |
| 10 | 8 |
| 11 #include <gtk/gtk.h> | 9 #include "chrome/browser/ui/gtk/collected_cookies_gtk.h" |
| 12 | 10 // TODO(msw): remove this file once all includes have been updated. |
| 13 #include "app/gtk_signal.h" | |
| 14 #include "base/scoped_ptr.h" | |
| 15 #include "chrome/browser/gtk/constrained_window_gtk.h" | |
| 16 #include "chrome/browser/gtk/gtk_tree.h" | |
| 17 #include "chrome/common/content_settings.h" | |
| 18 #include "chrome/common/notification_observer.h" | |
| 19 #include "chrome/common/notification_registrar.h" | |
| 20 | |
| 21 class CookiesTreeModel; | |
| 22 | |
| 23 // CollectedCookiesGtk is a dialog that displays the allowed and blocked | |
| 24 // cookies of the current tab contents. To display the dialog, invoke | |
| 25 // ShowCollectedCookiesDialog() on the delegate of the tab contents. | |
| 26 | |
| 27 class CollectedCookiesGtk : public ConstrainedDialogDelegate, | |
| 28 gtk_tree::TreeAdapter::Delegate, | |
| 29 NotificationObserver { | |
| 30 public: | |
| 31 CollectedCookiesGtk(GtkWindow* parent, TabContents* tab_contents); | |
| 32 | |
| 33 // ConstrainedDialogDelegate methods. | |
| 34 virtual GtkWidget* GetWidgetRoot(); | |
| 35 virtual void DeleteDelegate(); | |
| 36 | |
| 37 private: | |
| 38 virtual ~CollectedCookiesGtk(); | |
| 39 | |
| 40 // Initialize all widgets of this dialog. | |
| 41 void Init(); | |
| 42 | |
| 43 // True if the selection contains at least one origin node. | |
| 44 bool SelectionContainsOriginNode(GtkTreeSelection* selection, | |
| 45 gtk_tree::TreeAdapter* adapter); | |
| 46 | |
| 47 // Enable the allow/block buttons if at least one origin node is selected. | |
| 48 void EnableControls(); | |
| 49 | |
| 50 // Add exceptions for all origin nodes within the selection. | |
| 51 void AddExceptions(GtkTreeSelection* selection, | |
| 52 gtk_tree::TreeAdapter* adapter, | |
| 53 ContentSetting setting); | |
| 54 | |
| 55 // Notification Observer implementation. | |
| 56 virtual void Observe(NotificationType type, | |
| 57 const NotificationSource& source, | |
| 58 const NotificationDetails& details); | |
| 59 | |
| 60 // Callbacks. | |
| 61 CHROMEGTK_CALLBACK_2(CollectedCookiesGtk, void, OnTreeViewRowExpanded, | |
| 62 GtkTreeIter*, GtkTreePath*); | |
| 63 CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnTreeViewSelectionChange); | |
| 64 CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnClose); | |
| 65 CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnBlockAllowedButtonClicked); | |
| 66 CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, OnAllowBlockedButtonClicked); | |
| 67 CHROMEGTK_CALLBACK_0(CollectedCookiesGtk, void, | |
| 68 OnForSessionBlockedButtonClicked); | |
| 69 | |
| 70 NotificationRegistrar registrar_; | |
| 71 | |
| 72 ConstrainedWindow* window_; | |
| 73 | |
| 74 // Widgets of the dialog. | |
| 75 GtkWidget* dialog_; | |
| 76 | |
| 77 GtkWidget* allowed_description_label_; | |
| 78 GtkWidget* blocked_description_label_; | |
| 79 | |
| 80 GtkWidget* block_allowed_cookie_button_; | |
| 81 | |
| 82 GtkWidget* allow_blocked_cookie_button_; | |
| 83 GtkWidget* for_session_blocked_cookie_button_; | |
| 84 | |
| 85 // The table listing the cookies. | |
| 86 GtkWidget* allowed_tree_; | |
| 87 GtkWidget* blocked_tree_; | |
| 88 | |
| 89 GtkTreeSelection* allowed_selection_; | |
| 90 GtkTreeSelection* blocked_selection_; | |
| 91 | |
| 92 // The infobar widget. | |
| 93 GtkWidget* infobar_; | |
| 94 GtkWidget* infobar_label_; | |
| 95 | |
| 96 // The tab contents. | |
| 97 TabContents* tab_contents_; | |
| 98 | |
| 99 // The Cookies Table model. | |
| 100 scoped_ptr<CookiesTreeModel> allowed_cookies_tree_model_; | |
| 101 scoped_ptr<CookiesTreeModel> blocked_cookies_tree_model_; | |
| 102 scoped_ptr<gtk_tree::TreeAdapter> allowed_cookies_tree_adapter_; | |
| 103 scoped_ptr<gtk_tree::TreeAdapter> blocked_cookies_tree_adapter_; | |
| 104 | |
| 105 DISALLOW_COPY_AND_ASSIGN(CollectedCookiesGtk); | |
| 106 }; | |
| 107 | 11 |
| 108 #endif // CHROME_BROWSER_GTK_COLLECTED_COOKIES_GTK_H_ | 12 #endif // CHROME_BROWSER_GTK_COLLECTED_COOKIES_GTK_H_ |
| OLD | NEW |