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 "ui/base/gtk/gtk_hig_constants.h" | 10 #include "ui/base/gtk/gtk_hig_constants.h" |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 gtk_entry_set_text(GTK_ENTRY(self->cookie_content_entry_), | 471 gtk_entry_set_text(GTK_ENTRY(self->cookie_content_entry_), |
472 cookie.Value().c_str()); | 472 cookie.Value().c_str()); |
473 gtk_entry_set_text(GTK_ENTRY(self->cookie_domain_entry_), | 473 gtk_entry_set_text(GTK_ENTRY(self->cookie_domain_entry_), |
474 domain.c_str()); | 474 domain.c_str()); |
475 gtk_entry_set_text(GTK_ENTRY(self->cookie_path_entry_), | 475 gtk_entry_set_text(GTK_ENTRY(self->cookie_path_entry_), |
476 cookie.Path().c_str()); | 476 cookie.Path().c_str()); |
477 gtk_entry_set_text(GTK_ENTRY(self->cookie_created_entry_), | 477 gtk_entry_set_text(GTK_ENTRY(self->cookie_created_entry_), |
478 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( | 478 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( |
479 cookie.CreationDate())).c_str()); | 479 cookie.CreationDate())).c_str()); |
480 | 480 |
481 std::string expire_text = cookie.DoesExpire() ? | 481 std::string expire_text = cookie.IsPersistent() ? |
482 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate())) : | 482 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate())) : |
483 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION); | 483 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION); |
484 | 484 |
485 if (self->cookie_expires_entry_) { | 485 if (self->cookie_expires_entry_) { |
486 gtk_entry_set_text(GTK_ENTRY(self->cookie_expires_entry_), | 486 gtk_entry_set_text(GTK_ENTRY(self->cookie_expires_entry_), |
487 expire_text.c_str()); | 487 expire_text.c_str()); |
488 } else { | 488 } else { |
489 GtkListStore* store = self->cookie_expires_combobox_store_; | 489 GtkListStore* store = self->cookie_expires_combobox_store_; |
490 GtkTreeIter iter; | 490 GtkTreeIter iter; |
491 gtk_list_store_clear(store); | 491 gtk_list_store_clear(store); |
492 | 492 |
493 if (cookie.DoesExpire()) { | 493 if (cookie.IsPersistent()) { |
494 gtk_list_store_append(store, &iter); | 494 gtk_list_store_append(store, &iter); |
495 gtk_list_store_set(store, &iter, 0, expire_text.c_str(), -1); | 495 gtk_list_store_set(store, &iter, 0, expire_text.c_str(), -1); |
496 } | 496 } |
497 | 497 |
498 gtk_list_store_append(store, &iter); | 498 gtk_list_store_append(store, &iter); |
499 gtk_list_store_set( | 499 gtk_list_store_set( |
500 store, &iter, 0, | 500 store, &iter, 0, |
501 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION).c_str(), | 501 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION).c_str(), |
502 -1); | 502 -1); |
503 | 503 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 int store_size = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); | 654 int store_size = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
655 if (store_size == 1) | 655 if (store_size == 1) |
656 return false; | 656 return false; |
657 | 657 |
658 DCHECK_EQ(2, store_size); | 658 DCHECK_EQ(2, store_size); |
659 | 659 |
660 int selected = gtk_combo_box_get_active(GTK_COMBO_BOX( | 660 int selected = gtk_combo_box_get_active(GTK_COMBO_BOX( |
661 self->cookie_expires_combobox_)); | 661 self->cookie_expires_combobox_)); |
662 return selected == 1; | 662 return selected == 1; |
663 } | 663 } |
OLD | NEW |