OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/ui/gtk/gtk_chrome_cookie_view.h" | 5 #include "chrome/browser/ui/gtk/gtk_chrome_cookie_view.h" |
6 | 6 |
7 #include "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "net/cookies/canonical_cookie.h" |
10 #include "net/cookies/parsed_cookie.h" | 11 #include "net/cookies/parsed_cookie.h" |
11 #include "ui/base/gtk/gtk_hig_constants.h" | 12 #include "ui/base/gtk/gtk_hig_constants.h" |
12 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
13 #include "ui/base/text/bytes_formatting.h" | 14 #include "ui/base/text/bytes_formatting.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 void InitBrowserDetailStyle(GtkWidget* entry, GtkStyle* label_style, | 18 void InitBrowserDetailStyle(GtkWidget* entry, GtkStyle* label_style, |
18 GtkStyle* dialog_style) { | 19 GtkStyle* dialog_style) { |
19 gtk_widget_modify_fg(entry, GTK_STATE_NORMAL, | 20 gtk_widget_modify_fg(entry, GTK_STATE_NORMAL, |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 458 |
458 void gtk_chrome_cookie_view_clear(GtkChromeCookieView* self) { | 459 void gtk_chrome_cookie_view_clear(GtkChromeCookieView* self) { |
459 UpdateVisibleDetailedInfo(self, self->cookie_details_table_); | 460 UpdateVisibleDetailedInfo(self, self->cookie_details_table_); |
460 ClearCookieDetails(self); | 461 ClearCookieDetails(self); |
461 } | 462 } |
462 | 463 |
463 // Switches the display to showing the passed in cookie. | 464 // Switches the display to showing the passed in cookie. |
464 void gtk_chrome_cookie_view_display_cookie( | 465 void gtk_chrome_cookie_view_display_cookie( |
465 GtkChromeCookieView* self, | 466 GtkChromeCookieView* self, |
466 const std::string& domain, | 467 const std::string& domain, |
467 const net::CookieMonster::CanonicalCookie& cookie) { | 468 const net::CanonicalCookie& cookie) { |
468 UpdateVisibleDetailedInfo(self, self->cookie_details_table_); | 469 UpdateVisibleDetailedInfo(self, self->cookie_details_table_); |
469 | 470 |
470 gtk_entry_set_text(GTK_ENTRY(self->cookie_name_entry_), | 471 gtk_entry_set_text(GTK_ENTRY(self->cookie_name_entry_), |
471 cookie.Name().c_str()); | 472 cookie.Name().c_str()); |
472 gtk_entry_set_text(GTK_ENTRY(self->cookie_content_entry_), | 473 gtk_entry_set_text(GTK_ENTRY(self->cookie_content_entry_), |
473 cookie.Value().c_str()); | 474 cookie.Value().c_str()); |
474 gtk_entry_set_text(GTK_ENTRY(self->cookie_domain_entry_), | 475 gtk_entry_set_text(GTK_ENTRY(self->cookie_domain_entry_), |
475 domain.c_str()); | 476 domain.c_str()); |
476 gtk_entry_set_text(GTK_ENTRY(self->cookie_path_entry_), | 477 gtk_entry_set_text(GTK_ENTRY(self->cookie_path_entry_), |
477 cookie.Path().c_str()); | 478 cookie.Path().c_str()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 IDS_COOKIES_COOKIE_SENDFOR_SECURE : | 513 IDS_COOKIES_COOKIE_SENDFOR_SECURE : |
513 IDS_COOKIES_COOKIE_SENDFOR_ANY).c_str()); | 514 IDS_COOKIES_COOKIE_SENDFOR_ANY).c_str()); |
514 SetCookieDetailsSensitivity(self, TRUE); | 515 SetCookieDetailsSensitivity(self, TRUE); |
515 } | 516 } |
516 | 517 |
517 void gtk_chrome_cookie_view_display_cookie_string( | 518 void gtk_chrome_cookie_view_display_cookie_string( |
518 GtkChromeCookieView* self, | 519 GtkChromeCookieView* self, |
519 const GURL& url, | 520 const GURL& url, |
520 const std::string& cookie_line) { | 521 const std::string& cookie_line) { |
521 net::ParsedCookie pc(cookie_line); | 522 net::ParsedCookie pc(cookie_line); |
522 net::CookieMonster::CanonicalCookie cookie(url, pc); | 523 net::CanonicalCookie cookie(url, pc); |
523 | 524 |
524 gtk_chrome_cookie_view_display_cookie( | 525 gtk_chrome_cookie_view_display_cookie( |
525 self, | 526 self, |
526 pc.HasDomain() ? pc.Domain() : url.host(), | 527 pc.HasDomain() ? pc.Domain() : url.host(), |
527 cookie); | 528 cookie); |
528 } | 529 } |
529 | 530 |
530 // Switches the display to showing the passed in database. | 531 // Switches the display to showing the passed in database. |
531 void gtk_chrome_cookie_view_display_database( | 532 void gtk_chrome_cookie_view_display_database( |
532 GtkChromeCookieView* self, | 533 GtkChromeCookieView* self, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 int store_size = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); | 656 int store_size = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
656 if (store_size == 1) | 657 if (store_size == 1) |
657 return false; | 658 return false; |
658 | 659 |
659 DCHECK_EQ(2, store_size); | 660 DCHECK_EQ(2, store_size); |
660 | 661 |
661 int selected = gtk_combo_box_get_active(GTK_COMBO_BOX( | 662 int selected = gtk_combo_box_get_active(GTK_COMBO_BOX( |
662 self->cookie_expires_combobox_)); | 663 self->cookie_expires_combobox_)); |
663 return selected == 1; | 664 return selected == 1; |
664 } | 665 } |
OLD | NEW |