OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/gtk/options/cookies_view.h" | 5 #include "chrome/browser/gtk/options/cookies_view.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Response ids for our custom buttons. | 29 // Response ids for our custom buttons. |
30 enum { | 30 enum { |
31 RESPONSE_REMOVE = 1, | 31 RESPONSE_REMOVE = 1, |
32 RESPONSE_REMOVE_ALL | 32 RESPONSE_REMOVE_ALL |
33 }; | 33 }; |
34 | 34 |
35 // The currently open cookie manager, if any. | 35 // The currently open cookie manager, if any. |
36 CookiesView* instance_ = NULL; | 36 CookiesView* instance_ = NULL; |
37 | 37 |
38 void InitCookieDetailStyle(GtkWidget* entry, GtkStyle* label_style, | 38 void InitBrowserDetailStyle(GtkWidget* entry, GtkStyle* label_style, |
39 GtkStyle* dialog_style) { | 39 GtkStyle* dialog_style) { |
40 gtk_widget_modify_fg(entry, GTK_STATE_NORMAL, | 40 gtk_widget_modify_fg(entry, GTK_STATE_NORMAL, |
41 &label_style->fg[GTK_STATE_NORMAL]); | 41 &label_style->fg[GTK_STATE_NORMAL]); |
42 gtk_widget_modify_fg(entry, GTK_STATE_INSENSITIVE, | 42 gtk_widget_modify_fg(entry, GTK_STATE_INSENSITIVE, |
43 &label_style->fg[GTK_STATE_INSENSITIVE]); | 43 &label_style->fg[GTK_STATE_INSENSITIVE]); |
44 // GTK_NO_WINDOW widgets like GtkLabel don't draw their own background, so we | 44 // GTK_NO_WINDOW widgets like GtkLabel don't draw their own background, so we |
45 // combine the normal or insensitive foreground of the label style with the | 45 // combine the normal or insensitive foreground of the label style with the |
46 // normal background of the window style to achieve the "normal label" and | 46 // normal background of the window style to achieve the "normal label" and |
47 // "insensitive label" colors. | 47 // "insensitive label" colors. |
48 gtk_widget_modify_base(entry, GTK_STATE_NORMAL, | 48 gtk_widget_modify_base(entry, GTK_STATE_NORMAL, |
49 &dialog_style->bg[GTK_STATE_NORMAL]); | 49 &dialog_style->bg[GTK_STATE_NORMAL]); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 G_CALLBACK(OnTreeViewKeyPress), this); | 186 G_CALLBACK(OnTreeViewKeyPress), this); |
187 g_signal_connect(G_OBJECT(tree_), "row-expanded", | 187 g_signal_connect(G_OBJECT(tree_), "row-expanded", |
188 G_CALLBACK(OnTreeViewRowExpanded), this); | 188 G_CALLBACK(OnTreeViewRowExpanded), this); |
189 | 189 |
190 selection_ = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_)); | 190 selection_ = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_)); |
191 gtk_tree_selection_set_mode(selection_, GTK_SELECTION_SINGLE); | 191 gtk_tree_selection_set_mode(selection_, GTK_SELECTION_SINGLE); |
192 g_signal_connect(G_OBJECT(selection_), "changed", | 192 g_signal_connect(G_OBJECT(selection_), "changed", |
193 G_CALLBACK(OnSelectionChanged), this); | 193 G_CALLBACK(OnSelectionChanged), this); |
194 | 194 |
195 // Cookie details. | 195 // Cookie details. |
196 GtkWidget* details_frame = gtk_frame_new(NULL); | 196 GtkWidget* cookie_details_frame = gtk_frame_new(NULL); |
197 gtk_frame_set_shadow_type(GTK_FRAME(details_frame), GTK_SHADOW_ETCHED_IN); | 197 gtk_frame_set_shadow_type(GTK_FRAME(cookie_details_frame), |
198 gtk_box_pack_start(GTK_BOX(cookie_list_vbox), details_frame, | 198 GTK_SHADOW_ETCHED_IN); |
| 199 gtk_box_pack_start(GTK_BOX(cookie_list_vbox), cookie_details_frame, |
199 FALSE, FALSE, 0); | 200 FALSE, FALSE, 0); |
200 cookie_details_table_ = gtk_table_new(7, 2, FALSE); | 201 cookie_details_table_ = gtk_table_new(7, 2, FALSE); |
201 gtk_container_add(GTK_CONTAINER(details_frame), cookie_details_table_); | 202 gtk_container_add(GTK_CONTAINER(cookie_details_frame), cookie_details_table_); |
202 gtk_table_set_col_spacing(GTK_TABLE(cookie_details_table_), 0, | 203 gtk_table_set_col_spacing(GTK_TABLE(cookie_details_table_), 0, |
203 gtk_util::kLabelSpacing); | 204 gtk_util::kLabelSpacing); |
204 | 205 |
205 int row = 0; | 206 int row = 0; |
206 InitCookieDetailRow(row++, IDS_COOKIES_COOKIE_NAME_LABEL, | 207 InitDetailRow(row++, IDS_COOKIES_COOKIE_NAME_LABEL, |
207 &cookie_name_entry_); | 208 cookie_details_table_, &cookie_name_entry_); |
208 InitCookieDetailRow(row++, IDS_COOKIES_COOKIE_CONTENT_LABEL, | 209 InitDetailRow(row++, IDS_COOKIES_COOKIE_CONTENT_LABEL, |
209 &cookie_content_entry_); | 210 cookie_details_table_, &cookie_content_entry_); |
210 InitCookieDetailRow(row++, IDS_COOKIES_COOKIE_DOMAIN_LABEL, | 211 InitDetailRow(row++, IDS_COOKIES_COOKIE_DOMAIN_LABEL, |
211 &cookie_domain_entry_); | 212 cookie_details_table_, &cookie_domain_entry_); |
212 InitCookieDetailRow(row++, IDS_COOKIES_COOKIE_PATH_LABEL, | 213 InitDetailRow(row++, IDS_COOKIES_COOKIE_PATH_LABEL, |
213 &cookie_path_entry_); | 214 cookie_details_table_, &cookie_path_entry_); |
214 InitCookieDetailRow(row++, IDS_COOKIES_COOKIE_SENDFOR_LABEL, | 215 InitDetailRow(row++, IDS_COOKIES_COOKIE_SENDFOR_LABEL, |
215 &cookie_send_for_entry_); | 216 cookie_details_table_, &cookie_send_for_entry_); |
216 InitCookieDetailRow(row++, IDS_COOKIES_COOKIE_CREATED_LABEL, | 217 InitDetailRow(row++, IDS_COOKIES_COOKIE_CREATED_LABEL, |
217 &cookie_created_entry_); | 218 cookie_details_table_, &cookie_created_entry_); |
218 InitCookieDetailRow(row++, IDS_COOKIES_COOKIE_EXPIRES_LABEL, | 219 InitDetailRow(row++, IDS_COOKIES_COOKIE_EXPIRES_LABEL, |
219 &cookie_expires_entry_); | 220 cookie_details_table_, &cookie_expires_entry_); |
220 | 221 |
| 222 // Local storage details. |
| 223 GtkWidget* local_storage_details_frame = gtk_frame_new(NULL); |
| 224 gtk_frame_set_shadow_type(GTK_FRAME(local_storage_details_frame), |
| 225 GTK_SHADOW_ETCHED_IN); |
| 226 gtk_box_pack_start(GTK_BOX(cookie_list_vbox), local_storage_details_frame, |
| 227 FALSE, FALSE, 0); |
| 228 local_storage_details_table_ = gtk_table_new(3, 2, FALSE); |
| 229 gtk_container_add(GTK_CONTAINER(local_storage_details_frame), |
| 230 local_storage_details_table_); |
| 231 gtk_table_set_col_spacing(GTK_TABLE(local_storage_details_table_), 0, |
| 232 gtk_util::kLabelSpacing); |
| 233 |
| 234 row = 0; |
| 235 InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL, |
| 236 local_storage_details_table_, &local_storage_origin_entry_); |
| 237 InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL, |
| 238 local_storage_details_table_, &local_storage_size_entry_); |
| 239 InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL, |
| 240 local_storage_details_table_, |
| 241 &local_storage_last_modified_entry_); |
| 242 |
| 243 UpdateVisibleDetailedInfo(cookie_details_table_); |
221 // Populate the view. | 244 // Populate the view. |
222 cookies_tree_adapter_->Init(); | 245 cookies_tree_adapter_->Init(); |
223 SetInitialTreeState(); | 246 SetInitialTreeState(); |
224 EnableControls(); | 247 EnableControls(); |
225 } | 248 } |
226 | 249 |
227 void CookiesView::InitStylesAndShow() { | 250 void CookiesView::InitStylesAndShow() { |
228 // Realize a label so that its style gets initialized. | 251 // Realize a label so that its style gets initialized. |
229 gtk_widget_realize(description_label_); | 252 gtk_widget_realize(description_label_); |
230 gtk_widget_realize(dialog_); | 253 gtk_widget_realize(dialog_); |
231 GtkStyle* label_style = gtk_widget_get_style(description_label_); | 254 GtkStyle* label_style = gtk_widget_get_style(description_label_); |
232 GtkStyle* dialog_style = gtk_widget_get_style(dialog_); | 255 GtkStyle* dialog_style = gtk_widget_get_style(dialog_); |
233 | 256 |
234 InitCookieDetailStyle(cookie_name_entry_, label_style, dialog_style); | 257 // Cookie details. |
235 InitCookieDetailStyle(cookie_content_entry_, label_style, dialog_style); | 258 InitBrowserDetailStyle(cookie_name_entry_, label_style, dialog_style); |
236 InitCookieDetailStyle(cookie_domain_entry_, label_style, dialog_style); | 259 InitBrowserDetailStyle(cookie_content_entry_, label_style, dialog_style); |
237 InitCookieDetailStyle(cookie_path_entry_, label_style, dialog_style); | 260 InitBrowserDetailStyle(cookie_domain_entry_, label_style, dialog_style); |
238 InitCookieDetailStyle(cookie_send_for_entry_, label_style, dialog_style); | 261 InitBrowserDetailStyle(cookie_path_entry_, label_style, dialog_style); |
239 InitCookieDetailStyle(cookie_created_entry_, label_style, dialog_style); | 262 InitBrowserDetailStyle(cookie_send_for_entry_, label_style, dialog_style); |
240 InitCookieDetailStyle(cookie_expires_entry_, label_style, dialog_style); | 263 InitBrowserDetailStyle(cookie_created_entry_, label_style, dialog_style); |
| 264 InitBrowserDetailStyle(cookie_expires_entry_, label_style, dialog_style); |
| 265 |
| 266 // Local storage details. |
| 267 InitBrowserDetailStyle(local_storage_origin_entry_, label_style, |
| 268 dialog_style); |
| 269 InitBrowserDetailStyle(local_storage_size_entry_, label_style, dialog_style); |
| 270 InitBrowserDetailStyle(local_storage_last_modified_entry_, label_style, |
| 271 dialog_style); |
241 | 272 |
242 gtk_widget_show_all(dialog_); | 273 gtk_widget_show_all(dialog_); |
243 } | 274 } |
244 | 275 |
245 void CookiesView::InitCookieDetailRow(int row, int label_id, | 276 void CookiesView::InitDetailRow(int row, int label_id, |
246 GtkWidget** entry) { | 277 GtkWidget* details_table, GtkWidget** entry) { |
247 GtkWidget* name_label = gtk_label_new( | 278 GtkWidget* name_label = gtk_label_new( |
248 l10n_util::GetStringUTF8(label_id).c_str()); | 279 l10n_util::GetStringUTF8(label_id).c_str()); |
249 gtk_misc_set_alignment(GTK_MISC(name_label), 1, 0.5); | 280 gtk_misc_set_alignment(GTK_MISC(name_label), 1, 0.5); |
250 gtk_table_attach(GTK_TABLE(cookie_details_table_), name_label, | 281 gtk_table_attach(GTK_TABLE(details_table), name_label, |
251 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); | 282 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); |
252 | 283 |
253 *entry = gtk_entry_new(); | 284 *entry = gtk_entry_new(); |
254 | 285 |
255 gtk_entry_set_editable(GTK_ENTRY(*entry), FALSE); | 286 gtk_entry_set_editable(GTK_ENTRY(*entry), FALSE); |
256 gtk_entry_set_has_frame(GTK_ENTRY(*entry), FALSE); | 287 gtk_entry_set_has_frame(GTK_ENTRY(*entry), FALSE); |
257 gtk_table_attach_defaults(GTK_TABLE(cookie_details_table_), *entry, | 288 gtk_table_attach_defaults(GTK_TABLE(details_table), *entry, |
258 1, 2, row, row + 1); | 289 1, 2, row, row + 1); |
259 } | 290 } |
260 | 291 |
261 void CookiesView::SetInitialTreeState() { | 292 void CookiesView::SetInitialTreeState() { |
262 if (cookies_tree_model_->GetChildCount(cookies_tree_model_->GetRoot())) | 293 if (cookies_tree_model_->GetChildCount(cookies_tree_model_->GetRoot())) |
263 gtk_tree::SelectAndFocusRowNum(0, GTK_TREE_VIEW(tree_)); | 294 gtk_tree::SelectAndFocusRowNum(0, GTK_TREE_VIEW(tree_)); |
264 } | 295 } |
265 | 296 |
266 void CookiesView::EnableControls() { | 297 void CookiesView::EnableControls() { |
267 GtkTreeIter iter; | 298 GtkTreeIter iter; |
268 bool selected = gtk_tree_selection_get_selected(selection_, NULL, &iter); | 299 bool selected = gtk_tree_selection_get_selected(selection_, NULL, &iter); |
269 gtk_widget_set_sensitive(remove_button_, selected); | 300 gtk_widget_set_sensitive(remove_button_, selected); |
270 gtk_widget_set_sensitive( | 301 gtk_widget_set_sensitive( |
271 remove_all_button_, | 302 remove_all_button_, |
272 cookies_tree_model_->GetChildCount(cookies_tree_model_->GetRoot())); | 303 cookies_tree_model_->GetChildCount(cookies_tree_model_->GetRoot())); |
273 | 304 |
274 const gchar* filter_text = gtk_entry_get_text(GTK_ENTRY(filter_entry_)); | 305 const gchar* filter_text = gtk_entry_get_text(GTK_ENTRY(filter_entry_)); |
275 gtk_widget_set_sensitive(filter_clear_button_, filter_text && *filter_text); | 306 gtk_widget_set_sensitive(filter_clear_button_, filter_text && *filter_text); |
276 | 307 |
277 if (selected) { | 308 if (selected) { |
278 CookieTreeNode::DetailedInfo detailed_info = | 309 CookieTreeNode::DetailedInfo detailed_info = |
279 static_cast<CookieTreeNode*>( | 310 static_cast<CookieTreeNode*>( |
280 cookies_tree_adapter_->GetNode(&iter))->GetDetailedInfo(); | 311 cookies_tree_adapter_->GetNode(&iter))->GetDetailedInfo(); |
281 if (detailed_info.node_type == CookieTreeNode::DetailedInfo::TYPE_COOKIE) { | 312 if (detailed_info.node_type == CookieTreeNode::DetailedInfo::TYPE_COOKIE) { |
| 313 UpdateVisibleDetailedInfo(cookie_details_table_); |
282 PopulateCookieDetails(detailed_info.cookie->first, | 314 PopulateCookieDetails(detailed_info.cookie->first, |
283 detailed_info.cookie->second); | 315 detailed_info.cookie->second); |
| 316 } else if (detailed_info.node_type == |
| 317 CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE) { |
| 318 UpdateVisibleDetailedInfo(local_storage_details_table_); |
| 319 PopulateLocalStorageDetails(*detailed_info.local_storage_info); |
284 } else { | 320 } else { |
| 321 UpdateVisibleDetailedInfo(cookie_details_table_); |
285 ClearCookieDetails(); | 322 ClearCookieDetails(); |
286 } | 323 } |
287 } else { | 324 } else { |
288 ClearCookieDetails(); | 325 ClearCookieDetails(); |
289 } | 326 } |
290 } | 327 } |
291 | 328 |
292 void CookiesView::SetCookieDetailsSensitivity(gboolean enabled) { | 329 void CookiesView::SetCookieDetailsSensitivity(gboolean enabled) { |
293 gtk_widget_set_sensitive(cookie_name_entry_, enabled); | 330 gtk_widget_set_sensitive(cookie_name_entry_, enabled); |
294 gtk_widget_set_sensitive(cookie_content_entry_, enabled); | 331 gtk_widget_set_sensitive(cookie_content_entry_, enabled); |
295 gtk_widget_set_sensitive(cookie_domain_entry_, enabled); | 332 gtk_widget_set_sensitive(cookie_domain_entry_, enabled); |
296 gtk_widget_set_sensitive(cookie_path_entry_, enabled); | 333 gtk_widget_set_sensitive(cookie_path_entry_, enabled); |
297 gtk_widget_set_sensitive(cookie_send_for_entry_, enabled); | 334 gtk_widget_set_sensitive(cookie_send_for_entry_, enabled); |
298 gtk_widget_set_sensitive(cookie_created_entry_, enabled); | 335 gtk_widget_set_sensitive(cookie_created_entry_, enabled); |
299 gtk_widget_set_sensitive(cookie_expires_entry_, enabled); | 336 gtk_widget_set_sensitive(cookie_expires_entry_, enabled); |
300 } | 337 } |
301 | 338 |
| 339 void CookiesView::SetLocalStorageDetailsSensitivity(gboolean enabled) { |
| 340 gtk_widget_set_sensitive(local_storage_origin_entry_, enabled); |
| 341 gtk_widget_set_sensitive(local_storage_size_entry_, enabled); |
| 342 gtk_widget_set_sensitive(local_storage_last_modified_entry_, enabled); |
| 343 } |
| 344 |
302 void CookiesView::PopulateCookieDetails( | 345 void CookiesView::PopulateCookieDetails( |
303 const std::string& domain, | 346 const std::string& domain, |
304 const net::CookieMonster::CanonicalCookie& cookie) { | 347 const net::CookieMonster::CanonicalCookie& cookie) { |
305 gtk_entry_set_text(GTK_ENTRY(cookie_name_entry_), cookie.Name().c_str()); | 348 gtk_entry_set_text(GTK_ENTRY(cookie_name_entry_), cookie.Name().c_str()); |
306 gtk_entry_set_text(GTK_ENTRY(cookie_content_entry_), cookie.Value().c_str()); | 349 gtk_entry_set_text(GTK_ENTRY(cookie_content_entry_), cookie.Value().c_str()); |
307 gtk_entry_set_text(GTK_ENTRY(cookie_domain_entry_), domain.c_str()); | 350 gtk_entry_set_text(GTK_ENTRY(cookie_domain_entry_), domain.c_str()); |
308 gtk_entry_set_text(GTK_ENTRY(cookie_path_entry_), cookie.Path().c_str()); | 351 gtk_entry_set_text(GTK_ENTRY(cookie_path_entry_), cookie.Path().c_str()); |
309 gtk_entry_set_text(GTK_ENTRY(cookie_created_entry_), | 352 gtk_entry_set_text(GTK_ENTRY(cookie_created_entry_), |
310 WideToUTF8(base::TimeFormatFriendlyDateAndTime( | 353 WideToUTF8(base::TimeFormatFriendlyDateAndTime( |
311 cookie.CreationDate())).c_str()); | 354 cookie.CreationDate())).c_str()); |
312 if (cookie.DoesExpire()) { | 355 if (cookie.DoesExpire()) { |
313 gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), | 356 gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), |
314 WideToUTF8(base::TimeFormatFriendlyDateAndTime( | 357 WideToUTF8(base::TimeFormatFriendlyDateAndTime( |
315 cookie.ExpiryDate())).c_str()); | 358 cookie.ExpiryDate())).c_str()); |
316 } else { | 359 } else { |
317 gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), | 360 gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), |
318 l10n_util::GetStringUTF8( | 361 l10n_util::GetStringUTF8( |
319 IDS_COOKIES_COOKIE_EXPIRES_SESSION).c_str()); | 362 IDS_COOKIES_COOKIE_EXPIRES_SESSION).c_str()); |
320 } | 363 } |
321 gtk_entry_set_text( | 364 gtk_entry_set_text( |
322 GTK_ENTRY(cookie_send_for_entry_), | 365 GTK_ENTRY(cookie_send_for_entry_), |
323 l10n_util::GetStringUTF8(cookie.IsSecure() ? | 366 l10n_util::GetStringUTF8(cookie.IsSecure() ? |
324 IDS_COOKIES_COOKIE_SENDFOR_SECURE : | 367 IDS_COOKIES_COOKIE_SENDFOR_SECURE : |
325 IDS_COOKIES_COOKIE_SENDFOR_ANY).c_str()); | 368 IDS_COOKIES_COOKIE_SENDFOR_ANY).c_str()); |
326 SetCookieDetailsSensitivity(TRUE); | 369 SetCookieDetailsSensitivity(TRUE); |
327 } | 370 } |
328 | 371 |
| 372 void CookiesView::PopulateLocalStorageDetails( |
| 373 const BrowsingDataLocalStorageHelper::LocalStorageInfo& |
| 374 local_storage_info) { |
| 375 gtk_entry_set_text(GTK_ENTRY(local_storage_origin_entry_), |
| 376 local_storage_info.origin.c_str()); |
| 377 gtk_entry_set_text(GTK_ENTRY(local_storage_size_entry_), |
| 378 WideToUTF8(FormatBytes( |
| 379 local_storage_info.size, |
| 380 GetByteDisplayUnits(local_storage_info.size), |
| 381 true)).c_str()); |
| 382 gtk_entry_set_text(GTK_ENTRY(local_storage_last_modified_entry_), |
| 383 WideToUTF8(base::TimeFormatFriendlyDateAndTime( |
| 384 local_storage_info.last_modified)).c_str()); |
| 385 SetLocalStorageDetailsSensitivity(TRUE); |
| 386 } |
| 387 |
329 void CookiesView::ClearCookieDetails() { | 388 void CookiesView::ClearCookieDetails() { |
330 std::string no_cookie = | 389 std::string no_cookie = |
331 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_NONESELECTED); | 390 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_NONESELECTED); |
332 gtk_entry_set_text(GTK_ENTRY(cookie_name_entry_), no_cookie.c_str()); | 391 gtk_entry_set_text(GTK_ENTRY(cookie_name_entry_), no_cookie.c_str()); |
333 gtk_entry_set_text(GTK_ENTRY(cookie_content_entry_), no_cookie.c_str()); | 392 gtk_entry_set_text(GTK_ENTRY(cookie_content_entry_), no_cookie.c_str()); |
334 gtk_entry_set_text(GTK_ENTRY(cookie_domain_entry_), no_cookie.c_str()); | 393 gtk_entry_set_text(GTK_ENTRY(cookie_domain_entry_), no_cookie.c_str()); |
335 gtk_entry_set_text(GTK_ENTRY(cookie_path_entry_), no_cookie.c_str()); | 394 gtk_entry_set_text(GTK_ENTRY(cookie_path_entry_), no_cookie.c_str()); |
336 gtk_entry_set_text(GTK_ENTRY(cookie_created_entry_), no_cookie.c_str()); | 395 gtk_entry_set_text(GTK_ENTRY(cookie_created_entry_), no_cookie.c_str()); |
337 gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), no_cookie.c_str()); | 396 gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), no_cookie.c_str()); |
338 gtk_entry_set_text(GTK_ENTRY(cookie_send_for_entry_), no_cookie.c_str()); | 397 gtk_entry_set_text(GTK_ENTRY(cookie_send_for_entry_), no_cookie.c_str()); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 } | 489 } |
431 | 490 |
432 void CookiesView::UpdateFilterResults() { | 491 void CookiesView::UpdateFilterResults() { |
433 const gchar* text = gtk_entry_get_text(GTK_ENTRY(filter_entry_)); | 492 const gchar* text = gtk_entry_get_text(GTK_ENTRY(filter_entry_)); |
434 if (text) { | 493 if (text) { |
435 cookies_tree_model_->UpdateSearchResults(UTF8ToWide(text)); | 494 cookies_tree_model_->UpdateSearchResults(UTF8ToWide(text)); |
436 SetInitialTreeState(); | 495 SetInitialTreeState(); |
437 } | 496 } |
438 } | 497 } |
439 | 498 |
| 499 void CookiesView::UpdateVisibleDetailedInfo(GtkWidget* table) { |
| 500 // Toggle the parent (the table frame) visibility. |
| 501 gtk_widget_show(gtk_widget_get_parent(table)); |
| 502 GtkWidget* other = local_storage_details_table_; |
| 503 if (table == local_storage_details_table_) |
| 504 other = cookie_details_table_; |
| 505 gtk_widget_hide(gtk_widget_get_parent(other)); |
| 506 } |
| 507 |
440 // static | 508 // static |
441 void CookiesView::OnFilterEntryActivated(GtkEntry* entry, CookiesView* window) { | 509 void CookiesView::OnFilterEntryActivated(GtkEntry* entry, CookiesView* window) { |
442 window->filter_update_factory_.RevokeAll(); | 510 window->filter_update_factory_.RevokeAll(); |
443 window->UpdateFilterResults(); | 511 window->UpdateFilterResults(); |
444 } | 512 } |
445 | 513 |
446 // static | 514 // static |
447 void CookiesView::OnFilterEntryChanged(GtkEditable* editable, | 515 void CookiesView::OnFilterEntryChanged(GtkEditable* editable, |
448 CookiesView* window) { | 516 CookiesView* window) { |
449 window->filter_update_factory_.RevokeAll(); | 517 window->filter_update_factory_.RevokeAll(); |
450 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 518 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
451 window->filter_update_factory_.NewRunnableMethod( | 519 window->filter_update_factory_.NewRunnableMethod( |
452 &CookiesView::UpdateFilterResults), kSearchFilterDelayMs); | 520 &CookiesView::UpdateFilterResults), kSearchFilterDelayMs); |
453 window->EnableControls(); | 521 window->EnableControls(); |
454 } | 522 } |
455 | 523 |
456 // static | 524 // static |
457 void CookiesView::OnFilterClearButtonClicked(GtkButton* button, | 525 void CookiesView::OnFilterClearButtonClicked(GtkButton* button, |
458 CookiesView* window) { | 526 CookiesView* window) { |
459 gtk_entry_set_text(GTK_ENTRY(window->filter_entry_), ""); | 527 gtk_entry_set_text(GTK_ENTRY(window->filter_entry_), ""); |
460 window->filter_update_factory_.RevokeAll(); | 528 window->filter_update_factory_.RevokeAll(); |
461 window->UpdateFilterResults(); | 529 window->UpdateFilterResults(); |
462 } | 530 } |
OLD | NEW |