Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(798)

Side by Side Diff: chrome/browser/gtk/gtk_chrome_cookie_view.cc

Issue 6064003: Update the time formatting APIs to use string16.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/gtk_chrome_cookie_view.h" 5 #include "chrome/browser/gtk/gtk_chrome_cookie_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/gtk/gtk_util.h" 10 #include "chrome/browser/gtk/gtk_util.h"
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 467
468 gtk_entry_set_text(GTK_ENTRY(self->cookie_name_entry_), 468 gtk_entry_set_text(GTK_ENTRY(self->cookie_name_entry_),
469 cookie.Name().c_str()); 469 cookie.Name().c_str());
470 gtk_entry_set_text(GTK_ENTRY(self->cookie_content_entry_), 470 gtk_entry_set_text(GTK_ENTRY(self->cookie_content_entry_),
471 cookie.Value().c_str()); 471 cookie.Value().c_str());
472 gtk_entry_set_text(GTK_ENTRY(self->cookie_domain_entry_), 472 gtk_entry_set_text(GTK_ENTRY(self->cookie_domain_entry_),
473 domain.c_str()); 473 domain.c_str());
474 gtk_entry_set_text(GTK_ENTRY(self->cookie_path_entry_), 474 gtk_entry_set_text(GTK_ENTRY(self->cookie_path_entry_),
475 cookie.Path().c_str()); 475 cookie.Path().c_str());
476 gtk_entry_set_text(GTK_ENTRY(self->cookie_created_entry_), 476 gtk_entry_set_text(GTK_ENTRY(self->cookie_created_entry_),
477 WideToUTF8(base::TimeFormatFriendlyDateAndTime( 477 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
478 cookie.CreationDate())).c_str()); 478 cookie.CreationDate())).c_str());
479 479
480 std::string expire_text = cookie.DoesExpire() ? 480 std::string expire_text = cookie.DoesExpire() ?
481 WideToUTF8(base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate())) : 481 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate())) :
482 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION); 482 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION);
483 483
484 if (self->cookie_expires_entry_) { 484 if (self->cookie_expires_entry_) {
485 gtk_entry_set_text(GTK_ENTRY(self->cookie_expires_entry_), 485 gtk_entry_set_text(GTK_ENTRY(self->cookie_expires_entry_),
486 expire_text.c_str()); 486 expire_text.c_str());
487 } else { 487 } else {
488 GtkListStore* store = self->cookie_expires_combobox_store_; 488 GtkListStore* store = self->cookie_expires_combobox_store_;
489 GtkTreeIter iter; 489 GtkTreeIter iter;
490 gtk_list_store_clear(store); 490 gtk_list_store_clear(store);
491 491
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME).c_str() : 538 IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME).c_str() :
539 database_info.database_name.c_str()); 539 database_info.database_name.c_str());
540 gtk_entry_set_text(GTK_ENTRY(self->database_description_entry_), 540 gtk_entry_set_text(GTK_ENTRY(self->database_description_entry_),
541 database_info.description.c_str()); 541 database_info.description.c_str());
542 gtk_entry_set_text(GTK_ENTRY(self->database_size_entry_), 542 gtk_entry_set_text(GTK_ENTRY(self->database_size_entry_),
543 UTF16ToUTF8(FormatBytes( 543 UTF16ToUTF8(FormatBytes(
544 database_info.size, 544 database_info.size,
545 GetByteDisplayUnits(database_info.size), 545 GetByteDisplayUnits(database_info.size),
546 true)).c_str()); 546 true)).c_str());
547 gtk_entry_set_text(GTK_ENTRY(self->database_last_modified_entry_), 547 gtk_entry_set_text(GTK_ENTRY(self->database_last_modified_entry_),
548 WideToUTF8(base::TimeFormatFriendlyDateAndTime( 548 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
549 database_info.last_modified)).c_str()); 549 database_info.last_modified)).c_str());
550 SetDatabaseDetailsSensitivity(self, TRUE); 550 SetDatabaseDetailsSensitivity(self, TRUE);
551 } 551 }
552 552
553 // Switches the display to showing the passed in local storage data. 553 // Switches the display to showing the passed in local storage data.
554 void gtk_chrome_cookie_view_display_local_storage( 554 void gtk_chrome_cookie_view_display_local_storage(
555 GtkChromeCookieView* self, 555 GtkChromeCookieView* self,
556 const BrowsingDataLocalStorageHelper::LocalStorageInfo& 556 const BrowsingDataLocalStorageHelper::LocalStorageInfo&
557 local_storage_info) { 557 local_storage_info) {
558 UpdateVisibleDetailedInfo(self, self->local_storage_details_table_); 558 UpdateVisibleDetailedInfo(self, self->local_storage_details_table_);
559 559
560 gtk_entry_set_text(GTK_ENTRY(self->local_storage_origin_entry_), 560 gtk_entry_set_text(GTK_ENTRY(self->local_storage_origin_entry_),
561 local_storage_info.origin.c_str()); 561 local_storage_info.origin.c_str());
562 gtk_entry_set_text(GTK_ENTRY(self->local_storage_size_entry_), 562 gtk_entry_set_text(GTK_ENTRY(self->local_storage_size_entry_),
563 UTF16ToUTF8(FormatBytes( 563 UTF16ToUTF8(FormatBytes(
564 local_storage_info.size, 564 local_storage_info.size,
565 GetByteDisplayUnits(local_storage_info.size), 565 GetByteDisplayUnits(local_storage_info.size),
566 true)).c_str()); 566 true)).c_str());
567 gtk_entry_set_text(GTK_ENTRY(self->local_storage_last_modified_entry_), 567 gtk_entry_set_text(GTK_ENTRY(self->local_storage_last_modified_entry_),
568 WideToUTF8(base::TimeFormatFriendlyDateAndTime( 568 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
569 local_storage_info.last_modified)).c_str()); 569 local_storage_info.last_modified)).c_str());
570 SetLocalStorageDetailsSensitivity(self, TRUE); 570 SetLocalStorageDetailsSensitivity(self, TRUE);
571 } 571 }
572 572
573 // Switches the display to showing the passed in app cache. 573 // Switches the display to showing the passed in app cache.
574 void gtk_chrome_cookie_view_display_app_cache( 574 void gtk_chrome_cookie_view_display_app_cache(
575 GtkChromeCookieView* self, 575 GtkChromeCookieView* self,
576 const appcache::AppCacheInfo& info) { 576 const appcache::AppCacheInfo& info) {
577 UpdateVisibleDetailedInfo(self, self->appcache_details_table_); 577 UpdateVisibleDetailedInfo(self, self->appcache_details_table_);
578 578
579 gtk_entry_set_text(GTK_ENTRY(self->appcache_manifest_entry_), 579 gtk_entry_set_text(GTK_ENTRY(self->appcache_manifest_entry_),
580 info.manifest_url.spec().c_str()); 580 info.manifest_url.spec().c_str());
581 gtk_entry_set_text(GTK_ENTRY(self->appcache_size_entry_), 581 gtk_entry_set_text(GTK_ENTRY(self->appcache_size_entry_),
582 UTF16ToUTF8(FormatBytes( 582 UTF16ToUTF8(FormatBytes(
583 info.size, 583 info.size,
584 GetByteDisplayUnits(info.size), 584 GetByteDisplayUnits(info.size),
585 true)).c_str()); 585 true)).c_str());
586 gtk_entry_set_text(GTK_ENTRY(self->appcache_created_entry_), 586 gtk_entry_set_text(GTK_ENTRY(self->appcache_created_entry_),
587 WideToUTF8(base::TimeFormatFriendlyDateAndTime( 587 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
588 info.creation_time)).c_str()); 588 info.creation_time)).c_str());
589 gtk_entry_set_text(GTK_ENTRY(self->appcache_last_accessed_entry_), 589 gtk_entry_set_text(GTK_ENTRY(self->appcache_last_accessed_entry_),
590 WideToUTF8(base::TimeFormatFriendlyDateAndTime( 590 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
591 info.last_access_time)).c_str()); 591 info.last_access_time)).c_str());
592 SetAppCacheDetailsSensitivity(self, TRUE); 592 SetAppCacheDetailsSensitivity(self, TRUE);
593 } 593 }
594 594
595 // Switches the display to showing the passed in IndexedDB data. 595 // Switches the display to showing the passed in IndexedDB data.
596 void gtk_chrome_cookie_view_display_indexed_db( 596 void gtk_chrome_cookie_view_display_indexed_db(
597 GtkChromeCookieView* self, 597 GtkChromeCookieView* self,
598 const BrowsingDataIndexedDBHelper::IndexedDBInfo& indexed_db_info) { 598 const BrowsingDataIndexedDBHelper::IndexedDBInfo& indexed_db_info) {
599 UpdateVisibleDetailedInfo(self, self->indexed_db_details_table_); 599 UpdateVisibleDetailedInfo(self, self->indexed_db_details_table_);
600 600
601 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_origin_entry_), 601 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_origin_entry_),
602 indexed_db_info.origin.c_str()); 602 indexed_db_info.origin.c_str());
603 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_size_entry_), 603 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_size_entry_),
604 UTF16ToUTF8(FormatBytes( 604 UTF16ToUTF8(FormatBytes(
605 indexed_db_info.size, 605 indexed_db_info.size,
606 GetByteDisplayUnits(indexed_db_info.size), 606 GetByteDisplayUnits(indexed_db_info.size),
607 true)).c_str()); 607 true)).c_str());
608 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_last_modified_entry_), 608 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_last_modified_entry_),
609 WideToUTF8(base::TimeFormatFriendlyDateAndTime( 609 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
610 indexed_db_info.last_modified)).c_str()); 610 indexed_db_info.last_modified)).c_str());
611 SetLocalStorageDetailsSensitivity(self, TRUE); 611 SetLocalStorageDetailsSensitivity(self, TRUE);
612 } 612 }
613 613
614 void gtk_chrome_cookie_view_display_local_storage_item( 614 void gtk_chrome_cookie_view_display_local_storage_item(
615 GtkChromeCookieView* self, 615 GtkChromeCookieView* self,
616 const std::string& host, 616 const std::string& host,
617 const string16& key, 617 const string16& key,
618 const string16& value) { 618 const string16& value) {
619 UpdateVisibleDetailedInfo(self, self->local_storage_item_table_); 619 UpdateVisibleDetailedInfo(self, self->local_storage_item_table_);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 int store_size = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); 666 int store_size = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL);
667 if (store_size == 1) 667 if (store_size == 1)
668 return false; 668 return false;
669 669
670 DCHECK_EQ(2, store_size); 670 DCHECK_EQ(2, store_size);
671 671
672 int selected = gtk_combo_box_get_active(GTK_COMBO_BOX( 672 int selected = gtk_combo_box_get_active(GTK_COMBO_BOX(
673 self->cookie_expires_combobox_)); 673 self->cookie_expires_combobox_));
674 return selected == 1; 674 return selected == 1;
675 } 675 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698