1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_UI_GTK_GTK_CHROME_COOKIE_VIEW_H_
6 #define CHROME_BROWSER_UI_GTK_GTK_CHROME_COOKIE_VIEW_H_
12 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h"
13 #include "chrome/browser/browsing_data/browsing_data_database_helper.h"
14 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
15 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
20 class CanonicalCookie
;
25 #define GTK_TYPE_CHROME_COOKIE_VIEW gtk_chrome_cookie_view_get_type()
27 #define GTK_CHROME_COOKIE_VIEW(obj) \
28 (G_TYPE_CHECK_INSTANCE_CAST((obj), \
29 GTK_TYPE_CHROME_COOKIE_VIEW, GtkChromeCookieView))
31 #define GTK_CHROME_COOKIE_VIEW_CLASS(klass) \
32 (G_TYPE_CHECK_CLASS_CAST((klass), \
33 GTK_TYPE_CHROME_COOKIE_VIEW, GtkChromeCookieViewClass))
35 #define GTK_IS_CHROME_COOKIE_VIEW(obj) \
36 (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
37 GTK_TYPE_CHROME_COOKIE_VIEW))
39 #define GTK_IS_CHROME_COOKIE_VIEW_CLASS(klass) \
40 (G_TYPE_CHECK_CLASS_TYPE((klass), \
41 GTK_TYPE_CHROME_COOKIE_VIEW))
43 #define GTK_CHROME_COOKIE_VIEW_GET_CLASS(obj) \
44 (G_TYPE_INSTANCE_GET_CLASS((obj), \
45 GTK_TYPE_CHROME_COOKIE_VIEW, GtkChromeCookieViewClass))
47 // TODO(erg): Refactor the following class. It's continuously grown as more
48 // things have been added to it and should probably become a general key/value
49 // table. The problem is that any implementation for that would be much more
50 // complicated and would require changing a whole lot of code.
54 // All public for testing since I don't think there's a "friend" mechanism in
57 GtkWidget
* table_box_
;
59 // A label we keep around so we can access its GtkStyle* once it is realized.
60 GtkWidget
* first_label_
;
62 // The cookie details widgets.
63 GtkWidget
* cookie_details_table_
;
64 GtkWidget
* cookie_name_entry_
;
65 GtkWidget
* cookie_content_entry_
;
66 GtkWidget
* cookie_domain_entry_
;
67 GtkWidget
* cookie_path_entry_
;
68 GtkWidget
* cookie_send_for_entry_
;
69 GtkWidget
* cookie_created_entry_
;
71 // Note: These two widgets are mutually exclusive based on what
72 // |editable_expiration| was when the cookie view was created. One of these
73 // variables will be NULL.
74 GtkWidget
* cookie_expires_entry_
;
75 GtkWidget
* cookie_expires_combobox_
;
77 GtkListStore
* cookie_expires_combobox_store_
;
79 // The database details widgets.
80 GtkWidget
* database_details_table_
;
81 GtkWidget
* database_name_entry_
;
82 GtkWidget
* database_description_entry_
;
83 GtkWidget
* database_size_entry_
;
84 GtkWidget
* database_last_modified_entry_
;
86 // The local storage details widgets.
87 GtkWidget
* local_storage_details_table_
;
88 GtkWidget
* local_storage_origin_entry_
;
89 GtkWidget
* local_storage_size_entry_
;
90 GtkWidget
* local_storage_last_modified_entry_
;
92 // The appcache details widgets.
93 GtkWidget
* appcache_details_table_
;
94 GtkWidget
* appcache_manifest_entry_
;
95 GtkWidget
* appcache_size_entry_
;
96 GtkWidget
* appcache_created_entry_
;
97 GtkWidget
* appcache_last_accessed_entry_
;
99 // The IndexedDB details widgets.
100 GtkWidget
* indexed_db_details_table_
;
101 GtkWidget
* indexed_db_origin_entry_
;
102 GtkWidget
* indexed_db_size_entry_
;
103 GtkWidget
* indexed_db_last_modified_entry_
;
105 // The local storage item widgets.
106 GtkWidget
* local_storage_item_table_
;
107 GtkWidget
* local_storage_item_origin_entry_
;
108 GtkWidget
* local_storage_item_key_entry_
;
109 GtkWidget
* local_storage_item_value_entry_
;
111 // The database accessed widgets.
112 GtkWidget
* database_accessed_table_
;
113 GtkWidget
* database_accessed_origin_entry_
;
114 GtkWidget
* database_accessed_name_entry_
;
115 GtkWidget
* database_accessed_description_entry_
;
116 GtkWidget
* database_accessed_size_entry_
;
118 // The appcache created widgets.
119 GtkWidget
* appcache_created_table_
;
120 GtkWidget
* appcache_created_manifest_entry_
;
121 } GtkChromeCookieView
;
124 GtkFrameClass parent_class
;
125 } GtkChromeCookieViewClass
;
127 GType
gtk_chrome_cookie_view_get_type();
129 // Builds a new cookie view.
130 GtkWidget
* gtk_chrome_cookie_view_new(gboolean editable_expiration
);
132 // Clears the cookie view.
133 void gtk_chrome_cookie_view_clear(GtkChromeCookieView
* widget
);
135 // NOTE: The G_END_DECLS ends here instead of at the end of the document
136 // because we want to define some methods on GtkChromeCookieView that take C++
139 // NOTE: ^^^^^^^^^^^^^^^^^^^^^^^
141 // Switches the display to showing the passed in cookie.
142 void gtk_chrome_cookie_view_display_cookie(
143 GtkChromeCookieView
* widget
,
144 const std::string
& domain
,
145 const net::CanonicalCookie
& cookie
);
147 // Looks up the cookie_line in CookieMonster and displays that.
148 void gtk_chrome_cookie_view_display_cookie_string(
149 GtkChromeCookieView
* widget
,
151 const std::string
& cookie_line
);
153 // Switches the display to showing the passed in database.
154 void gtk_chrome_cookie_view_display_database(
155 GtkChromeCookieView
* widget
,
156 const BrowsingDataDatabaseHelper::DatabaseInfo
& database_info
);
158 // Switches the display to showing the passed in local storage data.
159 void gtk_chrome_cookie_view_display_local_storage(
160 GtkChromeCookieView
* widget
,
161 const BrowsingDataLocalStorageHelper::LocalStorageInfo
&
164 // Switches the display to showing the passed in app cache.
165 void gtk_chrome_cookie_view_display_app_cache(
166 GtkChromeCookieView
* widget
,
167 const appcache::AppCacheInfo
& info
);
169 // Switches the display to showing the passed in IndexedDB data.
170 void gtk_chrome_cookie_view_display_indexed_db(
171 GtkChromeCookieView
* widget
,
172 const content::IndexedDBInfo
& info
);
174 // Switches the display to an individual storage item.
175 void gtk_chrome_cookie_view_display_local_storage_item(
176 GtkChromeCookieView
* widget
,
177 const std::string
& host
,
178 const base::string16
& key
,
179 const base::string16
& value
);
181 void gtk_chrome_cookie_view_display_database_accessed(
182 GtkChromeCookieView
* self
,
183 const std::string
& host
,
184 const base::string16
& database_name
,
185 const base::string16
& display_name
,
186 unsigned long estimated_size
);
188 void gtk_chrome_cookie_view_display_appcache_created(
189 GtkChromeCookieView
* self
,
190 const GURL
& manifest_url
);
192 // If |editable_expiration| was true at construction time, returns the value of
193 // the combo box. Otherwise, returns false.
194 bool gtk_chrome_cookie_view_session_expires(GtkChromeCookieView
* self
);
196 #endif // CHROME_BROWSER_UI_GTK_GTK_CHROME_COOKIE_VIEW_H_