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