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

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

Issue 7189076: Localize strings, speeds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright dates Created 9 years, 6 months 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/ui/gtk/gtk_util.h" 9 #include "chrome/browser/ui/gtk/gtk_util.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/base/text/bytes_formatting.h"
12 13
13 namespace { 14 namespace {
14 15
15 void InitBrowserDetailStyle(GtkWidget* entry, GtkStyle* label_style, 16 void InitBrowserDetailStyle(GtkWidget* entry, GtkStyle* label_style,
16 GtkStyle* dialog_style) { 17 GtkStyle* dialog_style) {
17 gtk_widget_modify_fg(entry, GTK_STATE_NORMAL, 18 gtk_widget_modify_fg(entry, GTK_STATE_NORMAL,
18 &label_style->fg[GTK_STATE_NORMAL]); 19 &label_style->fg[GTK_STATE_NORMAL]);
19 gtk_widget_modify_fg(entry, GTK_STATE_INSENSITIVE, 20 gtk_widget_modify_fg(entry, GTK_STATE_INSENSITIVE,
20 &label_style->fg[GTK_STATE_INSENSITIVE]); 21 &label_style->fg[GTK_STATE_INSENSITIVE]);
21 // GTK_NO_WINDOW widgets like GtkLabel don't draw their own background, so we 22 // GTK_NO_WINDOW widgets like GtkLabel don't draw their own background, so we
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 534
534 gtk_entry_set_text( 535 gtk_entry_set_text(
535 GTK_ENTRY(self->database_name_entry_), 536 GTK_ENTRY(self->database_name_entry_),
536 database_info.database_name.empty() ? 537 database_info.database_name.empty() ?
537 l10n_util::GetStringUTF8( 538 l10n_util::GetStringUTF8(
538 IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME).c_str() : 539 IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME).c_str() :
539 database_info.database_name.c_str()); 540 database_info.database_name.c_str());
540 gtk_entry_set_text(GTK_ENTRY(self->database_description_entry_), 541 gtk_entry_set_text(GTK_ENTRY(self->database_description_entry_),
541 database_info.description.c_str()); 542 database_info.description.c_str());
542 gtk_entry_set_text(GTK_ENTRY(self->database_size_entry_), 543 gtk_entry_set_text(GTK_ENTRY(self->database_size_entry_),
543 UTF16ToUTF8(FormatBytes( 544 UTF16ToUTF8(ui::FormatBytes(database_info.size)).c_str());
544 database_info.size,
545 GetByteDisplayUnits(database_info.size),
546 true)).c_str());
547 gtk_entry_set_text(GTK_ENTRY(self->database_last_modified_entry_), 545 gtk_entry_set_text(GTK_ENTRY(self->database_last_modified_entry_),
548 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( 546 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
549 database_info.last_modified)).c_str()); 547 database_info.last_modified)).c_str());
550 SetDatabaseDetailsSensitivity(self, TRUE); 548 SetDatabaseDetailsSensitivity(self, TRUE);
551 } 549 }
552 550
553 // Switches the display to showing the passed in local storage data. 551 // Switches the display to showing the passed in local storage data.
554 void gtk_chrome_cookie_view_display_local_storage( 552 void gtk_chrome_cookie_view_display_local_storage(
555 GtkChromeCookieView* self, 553 GtkChromeCookieView* self,
556 const BrowsingDataLocalStorageHelper::LocalStorageInfo& 554 const BrowsingDataLocalStorageHelper::LocalStorageInfo&
557 local_storage_info) { 555 local_storage_info) {
558 UpdateVisibleDetailedInfo(self, self->local_storage_details_table_); 556 UpdateVisibleDetailedInfo(self, self->local_storage_details_table_);
559 557
560 gtk_entry_set_text(GTK_ENTRY(self->local_storage_origin_entry_), 558 gtk_entry_set_text(GTK_ENTRY(self->local_storage_origin_entry_),
561 local_storage_info.origin.c_str()); 559 local_storage_info.origin.c_str());
562 gtk_entry_set_text(GTK_ENTRY(self->local_storage_size_entry_), 560 gtk_entry_set_text(GTK_ENTRY(self->local_storage_size_entry_),
563 UTF16ToUTF8(FormatBytes( 561 UTF16ToUTF8(ui::FormatBytes(
564 local_storage_info.size, 562 local_storage_info.size)).c_str());
565 GetByteDisplayUnits(local_storage_info.size),
566 true)).c_str());
567 gtk_entry_set_text(GTK_ENTRY(self->local_storage_last_modified_entry_), 563 gtk_entry_set_text(GTK_ENTRY(self->local_storage_last_modified_entry_),
568 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( 564 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
569 local_storage_info.last_modified)).c_str()); 565 local_storage_info.last_modified)).c_str());
570 SetLocalStorageDetailsSensitivity(self, TRUE); 566 SetLocalStorageDetailsSensitivity(self, TRUE);
571 } 567 }
572 568
573 // Switches the display to showing the passed in app cache. 569 // Switches the display to showing the passed in app cache.
574 void gtk_chrome_cookie_view_display_app_cache( 570 void gtk_chrome_cookie_view_display_app_cache(
575 GtkChromeCookieView* self, 571 GtkChromeCookieView* self,
576 const appcache::AppCacheInfo& info) { 572 const appcache::AppCacheInfo& info) {
577 UpdateVisibleDetailedInfo(self, self->appcache_details_table_); 573 UpdateVisibleDetailedInfo(self, self->appcache_details_table_);
578 574
579 gtk_entry_set_text(GTK_ENTRY(self->appcache_manifest_entry_), 575 gtk_entry_set_text(GTK_ENTRY(self->appcache_manifest_entry_),
580 info.manifest_url.spec().c_str()); 576 info.manifest_url.spec().c_str());
581 gtk_entry_set_text(GTK_ENTRY(self->appcache_size_entry_), 577 gtk_entry_set_text(GTK_ENTRY(self->appcache_size_entry_),
582 UTF16ToUTF8(FormatBytes( 578 UTF16ToUTF8(ui::FormatBytes(info.size)).c_str());
583 info.size,
584 GetByteDisplayUnits(info.size),
585 true)).c_str());
586 gtk_entry_set_text(GTK_ENTRY(self->appcache_created_entry_), 579 gtk_entry_set_text(GTK_ENTRY(self->appcache_created_entry_),
587 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( 580 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
588 info.creation_time)).c_str()); 581 info.creation_time)).c_str());
589 gtk_entry_set_text(GTK_ENTRY(self->appcache_last_accessed_entry_), 582 gtk_entry_set_text(GTK_ENTRY(self->appcache_last_accessed_entry_),
590 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( 583 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
591 info.last_access_time)).c_str()); 584 info.last_access_time)).c_str());
592 SetAppCacheDetailsSensitivity(self, TRUE); 585 SetAppCacheDetailsSensitivity(self, TRUE);
593 } 586 }
594 587
595 // Switches the display to showing the passed in IndexedDB data. 588 // Switches the display to showing the passed in IndexedDB data.
596 void gtk_chrome_cookie_view_display_indexed_db( 589 void gtk_chrome_cookie_view_display_indexed_db(
597 GtkChromeCookieView* self, 590 GtkChromeCookieView* self,
598 const BrowsingDataIndexedDBHelper::IndexedDBInfo& indexed_db_info) { 591 const BrowsingDataIndexedDBHelper::IndexedDBInfo& indexed_db_info) {
599 UpdateVisibleDetailedInfo(self, self->indexed_db_details_table_); 592 UpdateVisibleDetailedInfo(self, self->indexed_db_details_table_);
600 593
601 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_origin_entry_), 594 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_origin_entry_),
602 indexed_db_info.origin.c_str()); 595 indexed_db_info.origin.c_str());
603 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_size_entry_), 596 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_size_entry_),
604 UTF16ToUTF8(FormatBytes( 597 UTF16ToUTF8(ui::FormatBytes(
605 indexed_db_info.size, 598 indexed_db_info.size)).c_str());
606 GetByteDisplayUnits(indexed_db_info.size),
607 true)).c_str());
608 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_last_modified_entry_), 599 gtk_entry_set_text(GTK_ENTRY(self->indexed_db_last_modified_entry_),
609 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( 600 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
610 indexed_db_info.last_modified)).c_str()); 601 indexed_db_info.last_modified)).c_str());
611 SetLocalStorageDetailsSensitivity(self, TRUE); 602 SetLocalStorageDetailsSensitivity(self, TRUE);
612 } 603 }
613 604
614 void gtk_chrome_cookie_view_display_local_storage_item( 605 void gtk_chrome_cookie_view_display_local_storage_item(
615 GtkChromeCookieView* self, 606 GtkChromeCookieView* self,
616 const std::string& host, 607 const std::string& host,
617 const string16& key, 608 const string16& key,
(...skipping 17 matching lines...) Expand all
635 unsigned long estimated_size) { 626 unsigned long estimated_size) {
636 UpdateVisibleDetailedInfo(self, self->database_accessed_table_); 627 UpdateVisibleDetailedInfo(self, self->database_accessed_table_);
637 628
638 gtk_entry_set_text(GTK_ENTRY(self->database_accessed_origin_entry_), 629 gtk_entry_set_text(GTK_ENTRY(self->database_accessed_origin_entry_),
639 host.c_str()); 630 host.c_str());
640 gtk_entry_set_text(GTK_ENTRY(self->database_accessed_name_entry_), 631 gtk_entry_set_text(GTK_ENTRY(self->database_accessed_name_entry_),
641 UTF16ToUTF8(database_name).c_str()); 632 UTF16ToUTF8(database_name).c_str());
642 gtk_entry_set_text(GTK_ENTRY(self->database_accessed_description_entry_), 633 gtk_entry_set_text(GTK_ENTRY(self->database_accessed_description_entry_),
643 UTF16ToUTF8(display_name).c_str()); 634 UTF16ToUTF8(display_name).c_str());
644 gtk_entry_set_text(GTK_ENTRY(self->database_accessed_size_entry_), 635 gtk_entry_set_text(GTK_ENTRY(self->database_accessed_size_entry_),
645 UTF16ToUTF8(FormatBytes( 636 UTF16ToUTF8(ui::FormatBytes(estimated_size)).c_str());
646 estimated_size,
647 GetByteDisplayUnits(estimated_size),
648 true)).c_str());
649 SetDatabaseAccessedSensitivity(self, TRUE); 637 SetDatabaseAccessedSensitivity(self, TRUE);
650 } 638 }
651 639
652 void gtk_chrome_cookie_view_display_appcache_created( 640 void gtk_chrome_cookie_view_display_appcache_created(
653 GtkChromeCookieView* self, 641 GtkChromeCookieView* self,
654 const GURL& manifest_url) { 642 const GURL& manifest_url) {
655 UpdateVisibleDetailedInfo(self, self->appcache_created_table_); 643 UpdateVisibleDetailedInfo(self, self->appcache_created_table_);
656 gtk_entry_set_text(GTK_ENTRY(self->appcache_created_manifest_entry_), 644 gtk_entry_set_text(GTK_ENTRY(self->appcache_created_manifest_entry_),
657 manifest_url.spec().c_str()); 645 manifest_url.spec().c_str());
658 SetAppCacheCreatedSensitivity(self, TRUE); 646 SetAppCacheCreatedSensitivity(self, TRUE);
659 } 647 }
660 648
661 bool gtk_chrome_cookie_view_session_expires(GtkChromeCookieView* self) { 649 bool gtk_chrome_cookie_view_session_expires(GtkChromeCookieView* self) {
662 if (self->cookie_expires_entry_) 650 if (self->cookie_expires_entry_)
663 return false; 651 return false;
664 652
665 GtkListStore* store = self->cookie_expires_combobox_store_; 653 GtkListStore* store = self->cookie_expires_combobox_store_;
666 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);
667 if (store_size == 1) 655 if (store_size == 1)
668 return false; 656 return false;
669 657
670 DCHECK_EQ(2, store_size); 658 DCHECK_EQ(2, store_size);
671 659
672 int selected = gtk_combo_box_get_active(GTK_COMBO_BOX( 660 int selected = gtk_combo_box_get_active(GTK_COMBO_BOX(
673 self->cookie_expires_combobox_)); 661 self->cookie_expires_combobox_));
674 return selected == 1; 662 return selected == 1;
675 } 663 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698