OLD | NEW |
1 // Copyright (c) 2011 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. | 5 // This is the Gtk implementation of the collected Cookies dialog. |
6 | 6 |
7 #ifndef CHROME_BROWSER_UI_GTK_COLLECTED_COOKIES_GTK_H_ | 7 #ifndef CHROME_BROWSER_UI_GTK_COLLECTED_COOKIES_GTK_H_ |
8 #define CHROME_BROWSER_UI_GTK_COLLECTED_COOKIES_GTK_H_ | 8 #define CHROME_BROWSER_UI_GTK_COLLECTED_COOKIES_GTK_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
11 #include <gtk/gtk.h> | 11 #include <gtk/gtk.h> |
12 | 12 |
| 13 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 15 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
15 #include "chrome/browser/ui/gtk/gtk_tree.h" | 16 #include "chrome/browser/ui/gtk/gtk_tree.h" |
16 #include "chrome/common/content_settings.h" | 17 #include "chrome/common/content_settings.h" |
17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
19 #include "ui/base/gtk/gtk_signal.h" | 20 #include "ui/base/gtk/gtk_signal.h" |
20 | 21 |
21 class CookiesTreeModel; | 22 class CookiesTreeModel; |
22 class TabContentsWrapper; | 23 class TabContentsWrapper; |
23 | 24 |
24 // CollectedCookiesGtk is a dialog that displays the allowed and blocked | 25 // CollectedCookiesGtk is a dialog that displays the allowed and blocked |
25 // cookies of the current tab contents. To display the dialog, invoke | 26 // cookies of the current tab contents. To display the dialog, invoke |
26 // ShowCollectedCookiesDialog() on the delegate of the tab contents wrapper's | 27 // ShowCollectedCookiesDialog() on the delegate of the tab contents wrapper's |
27 // content settings tab helper. | 28 // content settings tab helper. |
28 | 29 |
29 class CollectedCookiesGtk : public ConstrainedWindowGtkDelegate, | 30 class CollectedCookiesGtk : public ConstrainedWindowGtkDelegate, |
30 public gtk_tree::TreeAdapter::Delegate, | 31 public gtk_tree::TreeAdapter::Delegate, |
31 public content::NotificationObserver { | 32 public content::NotificationObserver { |
32 public: | 33 public: |
33 CollectedCookiesGtk(GtkWindow* parent, TabContentsWrapper* wrapper); | 34 CollectedCookiesGtk(GtkWindow* parent, TabContentsWrapper* wrapper); |
34 | 35 |
35 // ConstrainedWindowGtkDelegate methods. | 36 // ConstrainedWindowGtkDelegate methods. |
36 virtual GtkWidget* GetWidgetRoot(); | 37 virtual GtkWidget* GetWidgetRoot() OVERRIDE; |
37 virtual GtkWidget* GetFocusWidget(); | 38 virtual GtkWidget* GetFocusWidget() OVERRIDE; |
38 virtual void DeleteDelegate(); | 39 virtual void DeleteDelegate() OVERRIDE; |
39 | 40 |
40 private: | 41 private: |
41 virtual ~CollectedCookiesGtk(); | 42 virtual ~CollectedCookiesGtk(); |
42 | 43 |
43 // Initialize all widgets of this dialog. | 44 // Initialize all widgets of this dialog. |
44 void Init(); | 45 void Init(); |
45 | 46 |
46 // True if the selection contains at least one origin node. | 47 // True if the selection contains at least one origin node. |
47 bool SelectionContainsOriginNode(GtkTreeSelection* selection, | 48 bool SelectionContainsOriginNode(GtkTreeSelection* selection, |
48 gtk_tree::TreeAdapter* adapter); | 49 gtk_tree::TreeAdapter* adapter); |
49 | 50 |
50 // Enable the allow/block buttons if at least one origin node is selected. | 51 // Enable the allow/block buttons if at least one origin node is selected. |
51 void EnableControls(); | 52 void EnableControls(); |
52 | 53 |
53 // Add exceptions for all origin nodes within the selection. | 54 // Add exceptions for all origin nodes within the selection. |
54 void AddExceptions(GtkTreeSelection* selection, | 55 void AddExceptions(GtkTreeSelection* selection, |
55 gtk_tree::TreeAdapter* adapter, | 56 gtk_tree::TreeAdapter* adapter, |
56 ContentSetting setting); | 57 ContentSetting setting); |
57 | 58 |
58 // Notification Observer implementation. | 59 // Notification Observer implementation. |
59 virtual void Observe(int type, | 60 virtual void Observe(int type, |
60 const content::NotificationSource& source, | 61 const content::NotificationSource& source, |
61 const content::NotificationDetails& details); | 62 const content::NotificationDetails& details) OVERRIDE; |
62 | 63 |
63 // Create the information panes for the allowed and blocked cookies. | 64 // Create the information panes for the allowed and blocked cookies. |
64 GtkWidget* CreateAllowedPane(); | 65 GtkWidget* CreateAllowedPane(); |
65 GtkWidget* CreateBlockedPane(); | 66 GtkWidget* CreateBlockedPane(); |
66 | 67 |
67 // Show information about selected cookie in the cookie info view. | 68 // Show information about selected cookie in the cookie info view. |
68 void ShowCookieInfo(gint current_page); | 69 void ShowCookieInfo(gint current_page); |
69 void ShowSelectionInfo(GtkTreeSelection* selection, | 70 void ShowSelectionInfo(GtkTreeSelection* selection, |
70 gtk_tree::TreeAdapter* adapter); | 71 gtk_tree::TreeAdapter* adapter); |
71 | 72 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // The Cookies Table model. | 122 // The Cookies Table model. |
122 scoped_ptr<CookiesTreeModel> allowed_cookies_tree_model_; | 123 scoped_ptr<CookiesTreeModel> allowed_cookies_tree_model_; |
123 scoped_ptr<CookiesTreeModel> blocked_cookies_tree_model_; | 124 scoped_ptr<CookiesTreeModel> blocked_cookies_tree_model_; |
124 scoped_ptr<gtk_tree::TreeAdapter> allowed_cookies_tree_adapter_; | 125 scoped_ptr<gtk_tree::TreeAdapter> allowed_cookies_tree_adapter_; |
125 scoped_ptr<gtk_tree::TreeAdapter> blocked_cookies_tree_adapter_; | 126 scoped_ptr<gtk_tree::TreeAdapter> blocked_cookies_tree_adapter_; |
126 | 127 |
127 DISALLOW_COPY_AND_ASSIGN(CollectedCookiesGtk); | 128 DISALLOW_COPY_AND_ASSIGN(CollectedCookiesGtk); |
128 }; | 129 }; |
129 | 130 |
130 #endif // CHROME_BROWSER_UI_GTK_COLLECTED_COOKIES_GTK_H_ | 131 #endif // CHROME_BROWSER_UI_GTK_COLLECTED_COOKIES_GTK_H_ |
OLD | NEW |