diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-03 20:37:35 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-03 20:37:35 +0000 |
commit | 85e7dd78ed4cc286604129d633ebb27066764c65 (patch) | |
tree | cb32e0882661be133fabcf54912f29486dc08165 /chrome/browser | |
parent | ddae38aea776d394670731990ee0cb74feac1999 (diff) | |
download | chromium_src-85e7dd78ed4cc286604129d633ebb27066764c65.zip chromium_src-85e7dd78ed4cc286604129d633ebb27066764c65.tar.gz chromium_src-85e7dd78ed4cc286604129d633ebb27066764c65.tar.bz2 |
GTK: Split out the cookie display into its own component for reuse in the cookie ask dialog.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/660459
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40535 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/gtk/cookie_display_gtk.cc | 325 | ||||
-rw-r--r-- | chrome/browser/gtk/cookie_display_gtk.h | 111 | ||||
-rw-r--r-- | chrome/browser/gtk/options/cookies_view.cc | 341 | ||||
-rw-r--r-- | chrome/browser/gtk/options/cookies_view.h | 73 | ||||
-rw-r--r-- | chrome/browser/gtk/options/cookies_view_unittest.cc | 55 |
5 files changed, 492 insertions, 413 deletions
diff --git a/chrome/browser/gtk/cookie_display_gtk.cc b/chrome/browser/gtk/cookie_display_gtk.cc new file mode 100644 index 0000000..a410c79 --- /dev/null +++ b/chrome/browser/gtk/cookie_display_gtk.cc @@ -0,0 +1,325 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/gtk/cookie_display_gtk.h" + +#include "app/l10n_util.h" +#include "base/i18n/time_formatting.h" +#include "chrome/browser/gtk/gtk_util.h" +#include "grit/generated_resources.h" + +namespace { + +void InitBrowserDetailStyle(GtkWidget* entry, GtkStyle* label_style, + GtkStyle* dialog_style) { + gtk_widget_modify_fg(entry, GTK_STATE_NORMAL, + &label_style->fg[GTK_STATE_NORMAL]); + gtk_widget_modify_fg(entry, GTK_STATE_INSENSITIVE, + &label_style->fg[GTK_STATE_INSENSITIVE]); + // GTK_NO_WINDOW widgets like GtkLabel don't draw their own background, so we + // combine the normal or insensitive foreground of the label style with the + // normal background of the window style to achieve the "normal label" and + // "insensitive label" colors. + gtk_widget_modify_base(entry, GTK_STATE_NORMAL, + &dialog_style->bg[GTK_STATE_NORMAL]); + gtk_widget_modify_base(entry, GTK_STATE_INSENSITIVE, + &dialog_style->bg[GTK_STATE_NORMAL]); +} + +} // namespace + +CookieDisplayGtk::CookieDisplayGtk(GtkStyle* label_style, + GtkStyle* dialog_style) { + table_box_ = gtk_vbox_new(FALSE, 0); + + // Cookie details. + cookie_details_table_ = gtk_table_new(7, 2, FALSE); + gtk_container_add(GTK_CONTAINER(table_box_), cookie_details_table_); + gtk_table_set_col_spacing(GTK_TABLE(cookie_details_table_), 0, + gtk_util::kLabelSpacing); + + int row = 0; + InitDetailRow(row++, IDS_COOKIES_COOKIE_NAME_LABEL, + cookie_details_table_, &cookie_name_entry_); + InitDetailRow(row++, IDS_COOKIES_COOKIE_CONTENT_LABEL, + cookie_details_table_, &cookie_content_entry_); + InitDetailRow(row++, IDS_COOKIES_COOKIE_DOMAIN_LABEL, + cookie_details_table_, &cookie_domain_entry_); + InitDetailRow(row++, IDS_COOKIES_COOKIE_PATH_LABEL, + cookie_details_table_, &cookie_path_entry_); + InitDetailRow(row++, IDS_COOKIES_COOKIE_SENDFOR_LABEL, + cookie_details_table_, &cookie_send_for_entry_); + InitDetailRow(row++, IDS_COOKIES_COOKIE_CREATED_LABEL, + cookie_details_table_, &cookie_created_entry_); + InitDetailRow(row++, IDS_COOKIES_COOKIE_EXPIRES_LABEL, + cookie_details_table_, &cookie_expires_entry_); + + // Database details. + database_details_table_ = gtk_table_new(4, 2, FALSE); + gtk_container_add(GTK_CONTAINER(table_box_), + database_details_table_); + gtk_table_set_col_spacing(GTK_TABLE(database_details_table_), 0, + gtk_util::kLabelSpacing); + + InitDetailRow(row++, IDS_COOKIES_COOKIE_NAME_LABEL, + database_details_table_, &database_name_entry_); + InitDetailRow(row++, IDS_COOKIES_WEB_DATABASE_DESCRIPTION_LABEL, + database_details_table_, &database_description_entry_); + InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL, + database_details_table_, &database_size_entry_); + InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL, + database_details_table_, + &database_last_modified_entry_); + + // Local storage details. + local_storage_details_table_ = gtk_table_new(3, 2, FALSE); + gtk_container_add(GTK_CONTAINER(table_box_), local_storage_details_table_); + gtk_table_set_col_spacing(GTK_TABLE(local_storage_details_table_), 0, + gtk_util::kLabelSpacing); + + row = 0; + InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL, + local_storage_details_table_, &local_storage_origin_entry_); + InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL, + local_storage_details_table_, &local_storage_size_entry_); + InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL, + local_storage_details_table_, + &local_storage_last_modified_entry_); + + // AppCache details. + appcache_details_table_ = gtk_table_new(4, 2, FALSE); + gtk_container_add(GTK_CONTAINER(table_box_), appcache_details_table_); + gtk_table_set_col_spacing(GTK_TABLE(appcache_details_table_), 0, + gtk_util::kLabelSpacing); + + row = 0; + InitDetailRow(row++, IDS_COOKIES_APPLICATION_CACHE_MANIFEST_LABEL, + appcache_details_table_, &appcache_manifest_entry_); + InitDetailRow(row++, IDS_COOKIES_SIZE_LABEL, + appcache_details_table_, &appcache_size_entry_); + InitDetailRow(row++, IDS_COOKIES_COOKIE_CREATED_LABEL, + appcache_details_table_, &appcache_created_entry_); + InitDetailRow(row++, IDS_COOKIES_LAST_ACCESSED_LABEL, + appcache_details_table_, &appcache_last_accessed_entry_); + + // Create our frame. + top_frame_.Own(gtk_frame_new(NULL)); + gtk_frame_set_shadow_type(GTK_FRAME(top_frame_.get()), GTK_SHADOW_ETCHED_IN); + gtk_container_add(GTK_CONTAINER(top_frame_.get()), table_box_); + + ClearDisplay(); + InitStyles(label_style, dialog_style); +} + +CookieDisplayGtk::~CookieDisplayGtk() { + top_frame_.Destroy(); +} + +void CookieDisplayGtk::ClearDisplay() { + UpdateVisibleDetailedInfo(cookie_details_table_); + ClearCookieDetails(); +} + +void CookieDisplayGtk::DisplayCookieDetails( + const std::string& domain, + const net::CookieMonster::CanonicalCookie& cookie) { + UpdateVisibleDetailedInfo(cookie_details_table_); + + gtk_entry_set_text(GTK_ENTRY(cookie_name_entry_), cookie.Name().c_str()); + gtk_entry_set_text(GTK_ENTRY(cookie_content_entry_), cookie.Value().c_str()); + gtk_entry_set_text(GTK_ENTRY(cookie_domain_entry_), domain.c_str()); + gtk_entry_set_text(GTK_ENTRY(cookie_path_entry_), cookie.Path().c_str()); + gtk_entry_set_text(GTK_ENTRY(cookie_created_entry_), + WideToUTF8(base::TimeFormatFriendlyDateAndTime( + cookie.CreationDate())).c_str()); + if (cookie.DoesExpire()) { + gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), + WideToUTF8(base::TimeFormatFriendlyDateAndTime( + cookie.ExpiryDate())).c_str()); + } else { + gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), + l10n_util::GetStringUTF8( + IDS_COOKIES_COOKIE_EXPIRES_SESSION).c_str()); + } + gtk_entry_set_text( + GTK_ENTRY(cookie_send_for_entry_), + l10n_util::GetStringUTF8(cookie.IsSecure() ? + IDS_COOKIES_COOKIE_SENDFOR_SECURE : + IDS_COOKIES_COOKIE_SENDFOR_ANY).c_str()); + SetCookieDetailsSensitivity(TRUE); +} + +void CookieDisplayGtk::DisplayDatabaseDetails( + const BrowsingDataDatabaseHelper::DatabaseInfo& database_info) { + UpdateVisibleDetailedInfo(database_details_table_); + + gtk_entry_set_text( + GTK_ENTRY(database_name_entry_), + database_info.database_name.empty() ? + l10n_util::GetStringUTF8( + IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME).c_str() : + database_info.database_name.c_str()); + gtk_entry_set_text(GTK_ENTRY(database_description_entry_), + database_info.description.c_str()); + gtk_entry_set_text(GTK_ENTRY(database_size_entry_), + WideToUTF8(FormatBytes( + database_info.size, + GetByteDisplayUnits(database_info.size), + true)).c_str()); + gtk_entry_set_text(GTK_ENTRY(database_last_modified_entry_), + WideToUTF8(base::TimeFormatFriendlyDateAndTime( + database_info.last_modified)).c_str()); + SetDatabaseDetailsSensitivity(TRUE); +} + +void CookieDisplayGtk::DisplayLocalStorageDetails( + const BrowsingDataLocalStorageHelper::LocalStorageInfo& + local_storage_info) { + UpdateVisibleDetailedInfo(local_storage_details_table_); + + gtk_entry_set_text(GTK_ENTRY(local_storage_origin_entry_), + local_storage_info.origin.c_str()); + gtk_entry_set_text(GTK_ENTRY(local_storage_size_entry_), + WideToUTF8(FormatBytes( + local_storage_info.size, + GetByteDisplayUnits(local_storage_info.size), + true)).c_str()); + gtk_entry_set_text(GTK_ENTRY(local_storage_last_modified_entry_), + WideToUTF8(base::TimeFormatFriendlyDateAndTime( + local_storage_info.last_modified)).c_str()); + SetLocalStorageDetailsSensitivity(TRUE); +} + +void CookieDisplayGtk::DisplayAppCacheDetails( + const BrowsingDataAppCacheHelper::AppCacheInfo& info) { + UpdateVisibleDetailedInfo(appcache_details_table_); + + gtk_entry_set_text(GTK_ENTRY(appcache_manifest_entry_), + info.manifest_url.spec().c_str()); + gtk_entry_set_text(GTK_ENTRY(appcache_size_entry_), + WideToUTF8(FormatBytes( + info.size, + GetByteDisplayUnits(info.size), + true)).c_str()); + gtk_entry_set_text(GTK_ENTRY(appcache_created_entry_), + WideToUTF8(base::TimeFormatFriendlyDateAndTime( + info.creation_time)).c_str()); + gtk_entry_set_text(GTK_ENTRY(appcache_last_accessed_entry_), + WideToUTF8(base::TimeFormatFriendlyDateAndTime( + info.last_access_time)).c_str()); + SetAppCacheDetailsSensitivity(TRUE); +} + +void CookieDisplayGtk::InitDetailRow(int row, int label_id, + GtkWidget* details_table, GtkWidget** entry) { + GtkWidget* name_label = gtk_label_new( + l10n_util::GetStringUTF8(label_id).c_str()); + gtk_misc_set_alignment(GTK_MISC(name_label), 1, 0.5); + gtk_table_attach(GTK_TABLE(details_table), name_label, + 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); + + *entry = gtk_entry_new(); + + gtk_entry_set_editable(GTK_ENTRY(*entry), FALSE); + gtk_entry_set_has_frame(GTK_ENTRY(*entry), FALSE); + gtk_table_attach_defaults(GTK_TABLE(details_table), *entry, + 1, 2, row, row + 1); +} + +void CookieDisplayGtk::InitStyles(GtkStyle* label_style, + GtkStyle* dialog_style) { + // Cookie details. + InitBrowserDetailStyle(cookie_name_entry_, label_style, dialog_style); + InitBrowserDetailStyle(cookie_content_entry_, label_style, dialog_style); + InitBrowserDetailStyle(cookie_domain_entry_, label_style, dialog_style); + InitBrowserDetailStyle(cookie_path_entry_, label_style, dialog_style); + InitBrowserDetailStyle(cookie_send_for_entry_, label_style, dialog_style); + InitBrowserDetailStyle(cookie_created_entry_, label_style, dialog_style); + InitBrowserDetailStyle(cookie_expires_entry_, label_style, dialog_style); + + // Database details. + InitBrowserDetailStyle(database_name_entry_, label_style, dialog_style); + InitBrowserDetailStyle(database_description_entry_, label_style, + dialog_style); + InitBrowserDetailStyle(database_size_entry_, label_style, dialog_style); + InitBrowserDetailStyle(database_last_modified_entry_, label_style, + dialog_style); + + // Local storage details. + InitBrowserDetailStyle(local_storage_origin_entry_, label_style, + dialog_style); + InitBrowserDetailStyle(local_storage_size_entry_, label_style, dialog_style); + InitBrowserDetailStyle(local_storage_last_modified_entry_, label_style, + dialog_style); + + // AppCache details. + InitBrowserDetailStyle(appcache_manifest_entry_, label_style, dialog_style); + InitBrowserDetailStyle(appcache_size_entry_, label_style, dialog_style); + InitBrowserDetailStyle(appcache_created_entry_, label_style, dialog_style); + InitBrowserDetailStyle(appcache_last_accessed_entry_, label_style, + dialog_style); +} + +void CookieDisplayGtk::UpdateVisibleDetailedInfo(GtkWidget* table) { + SetCookieDetailsSensitivity(table == cookie_details_table_); + SetDatabaseDetailsSensitivity(table == database_details_table_); + SetLocalStorageDetailsSensitivity(table == local_storage_details_table_); + SetAppCacheDetailsSensitivity(table == appcache_details_table_); + // Toggle the parent (the table frame) visibility and sensitivity. + gtk_widget_show(table_box_); + gtk_widget_show(table); + // Toggle the other tables. + if (table != cookie_details_table_) + gtk_widget_hide(cookie_details_table_); + if (table != database_details_table_) + gtk_widget_hide(database_details_table_); + if (table != local_storage_details_table_) + gtk_widget_hide(local_storage_details_table_); + if (table != appcache_details_table_) + gtk_widget_hide(appcache_details_table_); +} + + +void CookieDisplayGtk::SetCookieDetailsSensitivity(gboolean enabled) { + gtk_widget_set_sensitive(cookie_name_entry_, enabled); + gtk_widget_set_sensitive(cookie_content_entry_, enabled); + gtk_widget_set_sensitive(cookie_domain_entry_, enabled); + gtk_widget_set_sensitive(cookie_path_entry_, enabled); + gtk_widget_set_sensitive(cookie_send_for_entry_, enabled); + gtk_widget_set_sensitive(cookie_created_entry_, enabled); + gtk_widget_set_sensitive(cookie_expires_entry_, enabled); +} + +void CookieDisplayGtk::SetDatabaseDetailsSensitivity(gboolean enabled) { + gtk_widget_set_sensitive(database_name_entry_, enabled); + gtk_widget_set_sensitive(database_description_entry_, enabled); + gtk_widget_set_sensitive(database_size_entry_, enabled); + gtk_widget_set_sensitive(database_last_modified_entry_, enabled); +} + +void CookieDisplayGtk::SetLocalStorageDetailsSensitivity(gboolean enabled) { + gtk_widget_set_sensitive(local_storage_origin_entry_, enabled); + gtk_widget_set_sensitive(local_storage_size_entry_, enabled); + gtk_widget_set_sensitive(local_storage_last_modified_entry_, enabled); +} + +void CookieDisplayGtk::SetAppCacheDetailsSensitivity(gboolean enabled) { + gtk_widget_set_sensitive(appcache_manifest_entry_, enabled); + gtk_widget_set_sensitive(appcache_size_entry_, enabled); + gtk_widget_set_sensitive(appcache_created_entry_, enabled); + gtk_widget_set_sensitive(appcache_last_accessed_entry_, enabled); +} + +void CookieDisplayGtk::ClearCookieDetails() { + std::string no_cookie = + l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_NONESELECTED); + gtk_entry_set_text(GTK_ENTRY(cookie_name_entry_), no_cookie.c_str()); + gtk_entry_set_text(GTK_ENTRY(cookie_content_entry_), no_cookie.c_str()); + gtk_entry_set_text(GTK_ENTRY(cookie_domain_entry_), no_cookie.c_str()); + gtk_entry_set_text(GTK_ENTRY(cookie_path_entry_), no_cookie.c_str()); + gtk_entry_set_text(GTK_ENTRY(cookie_created_entry_), no_cookie.c_str()); + gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), no_cookie.c_str()); + gtk_entry_set_text(GTK_ENTRY(cookie_send_for_entry_), no_cookie.c_str()); + SetCookieDetailsSensitivity(FALSE); +} diff --git a/chrome/browser/gtk/cookie_display_gtk.h b/chrome/browser/gtk/cookie_display_gtk.h new file mode 100644 index 0000000..85992c2b --- /dev/null +++ b/chrome/browser/gtk/cookie_display_gtk.h @@ -0,0 +1,111 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_GTK_COOKIE_DISPLAY_GTK_H_ +#define CHROME_BROWSER_GTK_COOKIE_DISPLAY_GTK_H_ + +#include <gtk/gtk.h> + +#include "base/basictypes.h" +#include "base/scoped_ptr.h" +#include "chrome/browser/browsing_data_appcache_helper.h" +#include "chrome/browser/browsing_data_database_helper.h" +#include "chrome/browser/browsing_data_local_storage_helper.h" +#include "chrome/common/owned_widget_gtk.h" +#include "net/base/cookie_monster.h" + +class CookieDisplayGtk { + public: + // Builds the cookie display. The display will blend |label_style| and + // |dialog_style| to form the + CookieDisplayGtk(GtkStyle* label_style, GtkStyle* dialog_style); + virtual ~CookieDisplayGtk(); + + GtkWidget* widget() { return top_frame_.get(); } + + void ClearDisplay(); + + // Switches the display to showing the passed in cookie. + void DisplayCookieDetails(const std::string& domain, + const net::CookieMonster::CanonicalCookie& cookie); + + // Switches the display to showing |database_info|. + void DisplayDatabaseDetails( + const BrowsingDataDatabaseHelper::DatabaseInfo& database_info); + + void DisplayLocalStorageDetails( + const BrowsingDataLocalStorageHelper::LocalStorageInfo& + local_storage_info); + + void DisplayAppCacheDetails( + const BrowsingDataAppCacheHelper::AppCacheInfo& info); + + private: + // Helper for initializing cookie / local storage details table. + void InitDetailRow(int row, int label_id, + GtkWidget* details_table, GtkWidget** display_label); + + // Sets the style for each label. + void InitStyles(GtkStyle* label_style, GtkStyle* dialog_style); + + // Sets which of the detailed info table is visible. + void UpdateVisibleDetailedInfo(GtkWidget* table); + + // Set sensitivity of cookie details. + void SetCookieDetailsSensitivity(gboolean enabled); + + // Set sensitivity of database details. + void SetDatabaseDetailsSensitivity(gboolean enabled); + + // Set sensitivity of local storage details. + void SetLocalStorageDetailsSensitivity(gboolean enabled); + + // Set sensitivity of appcache details. + void SetAppCacheDetailsSensitivity(gboolean enabled); + + // Reset the cookie details display. + void ClearCookieDetails(); + + // The top level frame that we return in widget(). + OwnedWidgetGtk top_frame_; + + // An hbox which contains all the different tables we can show. + GtkWidget* table_box_; + + // The cookie details widgets. + GtkWidget* cookie_details_table_; + GtkWidget* cookie_name_entry_; + GtkWidget* cookie_content_entry_; + GtkWidget* cookie_domain_entry_; + GtkWidget* cookie_path_entry_; + GtkWidget* cookie_send_for_entry_; + GtkWidget* cookie_created_entry_; + GtkWidget* cookie_expires_entry_; + + // The database details widgets. + GtkWidget* database_details_table_; + GtkWidget* database_name_entry_; + GtkWidget* database_description_entry_; + GtkWidget* database_size_entry_; + GtkWidget* database_last_modified_entry_; + + // The local storage details widgets. + GtkWidget* local_storage_details_table_; + GtkWidget* local_storage_origin_entry_; + GtkWidget* local_storage_size_entry_; + GtkWidget* local_storage_last_modified_entry_; + + // The appcache details widgets. + GtkWidget* appcache_details_table_; + GtkWidget* appcache_manifest_entry_; + GtkWidget* appcache_size_entry_; + GtkWidget* appcache_created_entry_; + GtkWidget* appcache_last_accessed_entry_; + + friend class CookiesViewTest; + + DISALLOW_COPY_AND_ASSIGN(CookieDisplayGtk); +}; + +#endif // CHROME_BROWSER_GTK_COOKIE_DISPLAY_GTK_H_ diff --git a/chrome/browser/gtk/options/cookies_view.cc b/chrome/browser/gtk/options/cookies_view.cc index c045326..90725f9 100644 --- a/chrome/browser/gtk/options/cookies_view.cc +++ b/chrome/browser/gtk/options/cookies_view.cc @@ -10,11 +10,11 @@ #include "app/gfx/gtk_util.h" #include "app/l10n_util.h" -#include "base/i18n/time_formatting.h" #include "base/message_loop.h" #include "base/string_util.h" #include "chrome/browser/cookies_tree_model.h" #include "chrome/browser/gtk/gtk_util.h" +#include "chrome/browser/gtk/cookie_display_gtk.h" #include "grit/generated_resources.h" namespace { @@ -35,22 +35,6 @@ enum { // The currently open cookie manager, if any. CookiesView* instance_ = NULL; -void InitBrowserDetailStyle(GtkWidget* entry, GtkStyle* label_style, - GtkStyle* dialog_style) { - gtk_widget_modify_fg(entry, GTK_STATE_NORMAL, - &label_style->fg[GTK_STATE_NORMAL]); - gtk_widget_modify_fg(entry, GTK_STATE_INSENSITIVE, - &label_style->fg[GTK_STATE_INSENSITIVE]); - // GTK_NO_WINDOW widgets like GtkLabel don't draw their own background, so we - // combine the normal or insensitive foreground of the label style with the - // normal background of the window style to achieve the "normal label" and - // "insensitive label" colors. - gtk_widget_modify_base(entry, GTK_STATE_NORMAL, - &dialog_style->bg[GTK_STATE_NORMAL]); - gtk_widget_modify_base(entry, GTK_STATE_INSENSITIVE, - &dialog_style->bg[GTK_STATE_NORMAL]); -} - } // namespace CookiesView::~CookiesView() { @@ -77,7 +61,6 @@ void CookiesView::Show( browsing_data_database_helper, browsing_data_local_storage_helper, browsing_data_appcache_helper); - instance_->InitStylesAndShow(); } } @@ -93,6 +76,8 @@ CookiesView::CookiesView( browsing_data_appcache_helper_(browsing_data_appcache_helper), filter_update_factory_(this) { Init(parent); + gtk_widget_show_all(dialog_); + cookie_display_gtk_->ClearDisplay(); } void CookiesView::Init(GtkWindow* parent) { @@ -217,160 +202,19 @@ void CookiesView::Init(GtkWindow* parent) { g_signal_connect(selection_, "changed", G_CALLBACK(OnSelectionChanged), this); - // Cookie details. - GtkWidget* cookie_details_frame = gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(cookie_details_frame), - GTK_SHADOW_ETCHED_IN); - gtk_box_pack_start(GTK_BOX(cookie_list_vbox), cookie_details_frame, - FALSE, FALSE, 0); - cookie_details_table_ = gtk_table_new(7, 2, FALSE); - gtk_container_add(GTK_CONTAINER(cookie_details_frame), cookie_details_table_); - gtk_table_set_col_spacing(GTK_TABLE(cookie_details_table_), 0, - gtk_util::kLabelSpacing); - - int row = 0; - InitDetailRow(row++, IDS_COOKIES_COOKIE_NAME_LABEL, - cookie_details_table_, &cookie_name_entry_); - InitDetailRow(row++, IDS_COOKIES_COOKIE_CONTENT_LABEL, - cookie_details_table_, &cookie_content_entry_); - InitDetailRow(row++, IDS_COOKIES_COOKIE_DOMAIN_LABEL, - cookie_details_table_, &cookie_domain_entry_); - InitDetailRow(row++, IDS_COOKIES_COOKIE_PATH_LABEL, - cookie_details_table_, &cookie_path_entry_); - InitDetailRow(row++, IDS_COOKIES_COOKIE_SENDFOR_LABEL, - cookie_details_table_, &cookie_send_for_entry_); - InitDetailRow(row++, IDS_COOKIES_COOKIE_CREATED_LABEL, - cookie_details_table_, &cookie_created_entry_); - InitDetailRow(row++, IDS_COOKIES_COOKIE_EXPIRES_LABEL, - cookie_details_table_, &cookie_expires_entry_); - - // Database details. - GtkWidget* database_details_frame = gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(database_details_frame), - GTK_SHADOW_ETCHED_IN); - gtk_box_pack_start(GTK_BOX(cookie_list_vbox), database_details_frame, - FALSE, FALSE, 0); - database_details_table_ = gtk_table_new(4, 2, FALSE); - gtk_container_add(GTK_CONTAINER(database_details_frame), - database_details_table_); - gtk_table_set_col_spacing(GTK_TABLE(database_details_table_), 0, - gtk_util::kLabelSpacing); - - row = 0; - InitDetailRow(row++, IDS_COOKIES_COOKIE_NAME_LABEL, - database_details_table_, &database_name_entry_); - InitDetailRow(row++, IDS_COOKIES_WEB_DATABASE_DESCRIPTION_LABEL, - database_details_table_, &database_description_entry_); - InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL, - database_details_table_, &database_size_entry_); - InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL, - database_details_table_, - &database_last_modified_entry_); - - // Local storage details. - GtkWidget* local_storage_details_frame = gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(local_storage_details_frame), - GTK_SHADOW_ETCHED_IN); - gtk_box_pack_start(GTK_BOX(cookie_list_vbox), local_storage_details_frame, - FALSE, FALSE, 0); - local_storage_details_table_ = gtk_table_new(3, 2, FALSE); - gtk_container_add(GTK_CONTAINER(local_storage_details_frame), - local_storage_details_table_); - gtk_table_set_col_spacing(GTK_TABLE(local_storage_details_table_), 0, - gtk_util::kLabelSpacing); - - row = 0; - InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL, - local_storage_details_table_, &local_storage_origin_entry_); - InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL, - local_storage_details_table_, &local_storage_size_entry_); - InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL, - local_storage_details_table_, - &local_storage_last_modified_entry_); - - // AppCache details. - GtkWidget* appcache_details_frame = gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(appcache_details_frame), - GTK_SHADOW_ETCHED_IN); - gtk_box_pack_start(GTK_BOX(cookie_list_vbox), appcache_details_frame, - FALSE, FALSE, 0); - appcache_details_table_ = gtk_table_new(4, 2, FALSE); - gtk_container_add(GTK_CONTAINER(appcache_details_frame), - appcache_details_table_); - gtk_table_set_col_spacing(GTK_TABLE(appcache_details_table_), 0, - gtk_util::kLabelSpacing); - row = 0; - InitDetailRow(row++, IDS_COOKIES_APPLICATION_CACHE_MANIFEST_LABEL, - appcache_details_table_, &appcache_manifest_entry_); - InitDetailRow(row++, IDS_COOKIES_SIZE_LABEL, - appcache_details_table_, &appcache_size_entry_); - InitDetailRow(row++, IDS_COOKIES_COOKIE_CREATED_LABEL, - appcache_details_table_, &appcache_created_entry_); - InitDetailRow(row++, IDS_COOKIES_LAST_ACCESSED_LABEL, - appcache_details_table_, &appcache_last_accessed_entry_); - - UpdateVisibleDetailedInfo(cookie_details_table_); - // Populate the view. - cookies_tree_adapter_->Init(); - SetInitialTreeState(); - EnableControls(); -} - -void CookiesView::InitStylesAndShow() { - // Realize a label so that its style gets initialized. gtk_widget_realize(description_label_); gtk_widget_realize(dialog_); GtkStyle* label_style = gtk_widget_get_style(description_label_); GtkStyle* dialog_style = gtk_widget_get_style(dialog_); + cookie_display_gtk_.reset(new CookieDisplayGtk(label_style, dialog_style)); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), + cookie_display_gtk_->widget(), + FALSE, FALSE, 0); - // Cookie details. - InitBrowserDetailStyle(cookie_name_entry_, label_style, dialog_style); - InitBrowserDetailStyle(cookie_content_entry_, label_style, dialog_style); - InitBrowserDetailStyle(cookie_domain_entry_, label_style, dialog_style); - InitBrowserDetailStyle(cookie_path_entry_, label_style, dialog_style); - InitBrowserDetailStyle(cookie_send_for_entry_, label_style, dialog_style); - InitBrowserDetailStyle(cookie_created_entry_, label_style, dialog_style); - InitBrowserDetailStyle(cookie_expires_entry_, label_style, dialog_style); - - // Database details. - InitBrowserDetailStyle(database_name_entry_, label_style, dialog_style); - InitBrowserDetailStyle(database_description_entry_, label_style, - dialog_style); - InitBrowserDetailStyle(database_size_entry_, label_style, dialog_style); - InitBrowserDetailStyle(database_last_modified_entry_, label_style, - dialog_style); - - // Local storage details. - InitBrowserDetailStyle(local_storage_origin_entry_, label_style, - dialog_style); - InitBrowserDetailStyle(local_storage_size_entry_, label_style, dialog_style); - InitBrowserDetailStyle(local_storage_last_modified_entry_, label_style, - dialog_style); - - // AppCache details. - InitBrowserDetailStyle(appcache_manifest_entry_, label_style, dialog_style); - InitBrowserDetailStyle(appcache_size_entry_, label_style, dialog_style); - InitBrowserDetailStyle(appcache_created_entry_, label_style, dialog_style); - InitBrowserDetailStyle(appcache_last_accessed_entry_, label_style, - dialog_style); - - gtk_widget_show_all(dialog_); -} - -void CookiesView::InitDetailRow(int row, int label_id, - GtkWidget* details_table, GtkWidget** entry) { - GtkWidget* name_label = gtk_label_new( - l10n_util::GetStringUTF8(label_id).c_str()); - gtk_misc_set_alignment(GTK_MISC(name_label), 1, 0.5); - gtk_table_attach(GTK_TABLE(details_table), name_label, - 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); - - *entry = gtk_entry_new(); - - gtk_entry_set_editable(GTK_ENTRY(*entry), FALSE); - gtk_entry_set_has_frame(GTK_ENTRY(*entry), FALSE); - gtk_table_attach_defaults(GTK_TABLE(details_table), *entry, - 1, 2, row, row + 1); + // Populate the view. + cookies_tree_adapter_->Init(); + SetInitialTreeState(); + EnableControls(); } void CookiesView::SetInitialTreeState() { @@ -394,155 +238,26 @@ void CookiesView::EnableControls() { static_cast<CookieTreeNode*>( cookies_tree_adapter_->GetNode(&iter))->GetDetailedInfo(); if (detailed_info.node_type == CookieTreeNode::DetailedInfo::TYPE_COOKIE) { - UpdateVisibleDetailedInfo(cookie_details_table_); - PopulateCookieDetails(detailed_info.cookie->first, - detailed_info.cookie->second); + cookie_display_gtk_->DisplayCookieDetails(detailed_info.cookie->first, + detailed_info.cookie->second); } else if (detailed_info.node_type == CookieTreeNode::DetailedInfo::TYPE_DATABASE) { - UpdateVisibleDetailedInfo(database_details_table_); - PopulateDatabaseDetails(*detailed_info.database_info); + cookie_display_gtk_->DisplayDatabaseDetails(*detailed_info.database_info); } else if (detailed_info.node_type == CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE) { - UpdateVisibleDetailedInfo(local_storage_details_table_); - PopulateLocalStorageDetails(*detailed_info.local_storage_info); + cookie_display_gtk_->DisplayLocalStorageDetails( + *detailed_info.local_storage_info); } else if (detailed_info.node_type == CookieTreeNode::DetailedInfo::TYPE_APPCACHE) { - UpdateVisibleDetailedInfo(appcache_details_table_); - PopulateAppCacheDetails(*detailed_info.appcache_info); + cookie_display_gtk_->DisplayAppCacheDetails(*detailed_info.appcache_info); } else { - UpdateVisibleDetailedInfo(cookie_details_table_); - ClearCookieDetails(); + cookie_display_gtk_->ClearDisplay(); } } else { - ClearCookieDetails(); + cookie_display_gtk_->ClearDisplay(); } } -void CookiesView::SetCookieDetailsSensitivity(gboolean enabled) { - gtk_widget_set_sensitive(cookie_name_entry_, enabled); - gtk_widget_set_sensitive(cookie_content_entry_, enabled); - gtk_widget_set_sensitive(cookie_domain_entry_, enabled); - gtk_widget_set_sensitive(cookie_path_entry_, enabled); - gtk_widget_set_sensitive(cookie_send_for_entry_, enabled); - gtk_widget_set_sensitive(cookie_created_entry_, enabled); - gtk_widget_set_sensitive(cookie_expires_entry_, enabled); -} - -void CookiesView::SetDatabaseDetailsSensitivity(gboolean enabled) { - gtk_widget_set_sensitive(database_name_entry_, enabled); - gtk_widget_set_sensitive(database_description_entry_, enabled); - gtk_widget_set_sensitive(database_size_entry_, enabled); - gtk_widget_set_sensitive(database_last_modified_entry_, enabled); -} - -void CookiesView::SetLocalStorageDetailsSensitivity(gboolean enabled) { - gtk_widget_set_sensitive(local_storage_origin_entry_, enabled); - gtk_widget_set_sensitive(local_storage_size_entry_, enabled); - gtk_widget_set_sensitive(local_storage_last_modified_entry_, enabled); -} - -void CookiesView::SetAppCacheDetailsSensitivity(gboolean enabled) { - gtk_widget_set_sensitive(appcache_manifest_entry_, enabled); - gtk_widget_set_sensitive(appcache_size_entry_, enabled); - gtk_widget_set_sensitive(appcache_created_entry_, enabled); - gtk_widget_set_sensitive(appcache_last_accessed_entry_, enabled); -} - -void CookiesView::PopulateCookieDetails( - const std::string& domain, - const net::CookieMonster::CanonicalCookie& cookie) { - gtk_entry_set_text(GTK_ENTRY(cookie_name_entry_), cookie.Name().c_str()); - gtk_entry_set_text(GTK_ENTRY(cookie_content_entry_), cookie.Value().c_str()); - gtk_entry_set_text(GTK_ENTRY(cookie_domain_entry_), domain.c_str()); - gtk_entry_set_text(GTK_ENTRY(cookie_path_entry_), cookie.Path().c_str()); - gtk_entry_set_text(GTK_ENTRY(cookie_created_entry_), - WideToUTF8(base::TimeFormatFriendlyDateAndTime( - cookie.CreationDate())).c_str()); - if (cookie.DoesExpire()) { - gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), - WideToUTF8(base::TimeFormatFriendlyDateAndTime( - cookie.ExpiryDate())).c_str()); - } else { - gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), - l10n_util::GetStringUTF8( - IDS_COOKIES_COOKIE_EXPIRES_SESSION).c_str()); - } - gtk_entry_set_text( - GTK_ENTRY(cookie_send_for_entry_), - l10n_util::GetStringUTF8(cookie.IsSecure() ? - IDS_COOKIES_COOKIE_SENDFOR_SECURE : - IDS_COOKIES_COOKIE_SENDFOR_ANY).c_str()); - SetCookieDetailsSensitivity(TRUE); -} - -void CookiesView::PopulateDatabaseDetails( - const BrowsingDataDatabaseHelper::DatabaseInfo& database_info) { - gtk_entry_set_text( - GTK_ENTRY(database_name_entry_), - database_info.database_name.empty() ? - l10n_util::GetStringUTF8( - IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME).c_str() : - database_info.database_name.c_str()); - gtk_entry_set_text(GTK_ENTRY(database_description_entry_), - database_info.description.c_str()); - gtk_entry_set_text(GTK_ENTRY(database_size_entry_), - WideToUTF8(FormatBytes( - database_info.size, - GetByteDisplayUnits(database_info.size), - true)).c_str()); - gtk_entry_set_text(GTK_ENTRY(database_last_modified_entry_), - WideToUTF8(base::TimeFormatFriendlyDateAndTime( - database_info.last_modified)).c_str()); - SetDatabaseDetailsSensitivity(TRUE); -} - -void CookiesView::PopulateLocalStorageDetails( - const BrowsingDataLocalStorageHelper::LocalStorageInfo& - local_storage_info) { - gtk_entry_set_text(GTK_ENTRY(local_storage_origin_entry_), - local_storage_info.origin.c_str()); - gtk_entry_set_text(GTK_ENTRY(local_storage_size_entry_), - WideToUTF8(FormatBytes( - local_storage_info.size, - GetByteDisplayUnits(local_storage_info.size), - true)).c_str()); - gtk_entry_set_text(GTK_ENTRY(local_storage_last_modified_entry_), - WideToUTF8(base::TimeFormatFriendlyDateAndTime( - local_storage_info.last_modified)).c_str()); - SetLocalStorageDetailsSensitivity(TRUE); -} - -void CookiesView::PopulateAppCacheDetails( - const BrowsingDataAppCacheHelper::AppCacheInfo& info) { - gtk_entry_set_text(GTK_ENTRY(appcache_manifest_entry_), - info.manifest_url.spec().c_str()); - gtk_entry_set_text(GTK_ENTRY(appcache_size_entry_), - WideToUTF8(FormatBytes( - info.size, - GetByteDisplayUnits(info.size), - true)).c_str()); - gtk_entry_set_text(GTK_ENTRY(appcache_created_entry_), - WideToUTF8(base::TimeFormatFriendlyDateAndTime( - info.creation_time)).c_str()); - gtk_entry_set_text(GTK_ENTRY(appcache_last_accessed_entry_), - WideToUTF8(base::TimeFormatFriendlyDateAndTime( - info.last_access_time)).c_str()); - SetAppCacheDetailsSensitivity(TRUE); -} - -void CookiesView::ClearCookieDetails() { - std::string no_cookie = - l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_NONESELECTED); - gtk_entry_set_text(GTK_ENTRY(cookie_name_entry_), no_cookie.c_str()); - gtk_entry_set_text(GTK_ENTRY(cookie_content_entry_), no_cookie.c_str()); - gtk_entry_set_text(GTK_ENTRY(cookie_domain_entry_), no_cookie.c_str()); - gtk_entry_set_text(GTK_ENTRY(cookie_path_entry_), no_cookie.c_str()); - gtk_entry_set_text(GTK_ENTRY(cookie_created_entry_), no_cookie.c_str()); - gtk_entry_set_text(GTK_ENTRY(cookie_expires_entry_), no_cookie.c_str()); - gtk_entry_set_text(GTK_ENTRY(cookie_send_for_entry_), no_cookie.c_str()); - SetCookieDetailsSensitivity(FALSE); -} - void CookiesView::RemoveSelectedItems() { GtkTreeIter iter; bool selected = gtk_tree_selection_get_selected(selection_, NULL, &iter); @@ -641,24 +356,6 @@ void CookiesView::UpdateFilterResults() { } } -void CookiesView::UpdateVisibleDetailedInfo(GtkWidget* table) { - SetCookieDetailsSensitivity(table == cookie_details_table_); - SetDatabaseDetailsSensitivity(table == database_details_table_); - SetLocalStorageDetailsSensitivity(table == local_storage_details_table_); - SetAppCacheDetailsSensitivity(table == appcache_details_table_); - // Toggle the parent (the table frame) visibility and sensitivity. - gtk_widget_show(gtk_widget_get_parent(table)); - // Toggle the other tables. - if (table != cookie_details_table_) - gtk_widget_hide(gtk_widget_get_parent(cookie_details_table_)); - if (table != database_details_table_) - gtk_widget_hide(gtk_widget_get_parent(database_details_table_)); - if (table != local_storage_details_table_) - gtk_widget_hide(gtk_widget_get_parent(local_storage_details_table_)); - if (table != appcache_details_table_) - gtk_widget_hide(gtk_widget_get_parent(appcache_details_table_)); -} - // static void CookiesView::OnFilterEntryActivated(GtkEntry* entry, CookiesView* window) { window->filter_update_factory_.RevokeAll(); diff --git a/chrome/browser/gtk/options/cookies_view.h b/chrome/browser/gtk/options/cookies_view.h index 4686a50..e7a035e 100644 --- a/chrome/browser/gtk/options/cookies_view.h +++ b/chrome/browser/gtk/options/cookies_view.h @@ -19,6 +19,7 @@ #include "net/base/cookie_monster.h" #include "testing/gtest/include/gtest/gtest_prod.h" +class CookieDisplayGtk; class CookiesTreeModel; class CookiesViewTest; class Profile; @@ -56,51 +57,12 @@ class CookiesView : public gtk_tree::TreeAdapter::Delegate { // Initialize the dialog contents and layout. void Init(GtkWindow* parent); - // Initialize the widget styles and display the dialog. - void InitStylesAndShow(); - - // Helper for initializing cookie / local storage details table. - void InitDetailRow(int row, int label_id, - GtkWidget* details_table, GtkWidget** display_label); - // Set the initial selection and tree expanded state. void SetInitialTreeState(); // Set sensitivity of buttons based on selection and filter state. void EnableControls(); - // Set sensitivity of cookie details. - void SetCookieDetailsSensitivity(gboolean enabled); - - // Set sensitivity of database details. - void SetDatabaseDetailsSensitivity(gboolean enabled); - - // Set sensitivity of local storage details. - void SetLocalStorageDetailsSensitivity(gboolean enabled); - - // Set sensitivity of appcache details. - void SetAppCacheDetailsSensitivity(gboolean enabled); - - // Show the details of the currently selected cookie. - void PopulateCookieDetails(const std::string& domain, - const net::CookieMonster::CanonicalCookie& cookie); - - // Show the details of the currently selected database. - void PopulateDatabaseDetails( - const BrowsingDataDatabaseHelper::DatabaseInfo& database_info); - - // Show the details of the currently selected local storage. - void PopulateLocalStorageDetails( - const BrowsingDataLocalStorageHelper::LocalStorageInfo& - local_storage_info); - - // Show the details of the currently selected appcache. - void PopulateAppCacheDetails( - const BrowsingDataAppCacheHelper::AppCacheInfo& info); - - // Reset the cookie details display. - void ClearCookieDetails(); - // Remove any cookies that are currently selected. void RemoveSelectedItems(); @@ -126,9 +88,6 @@ class CookiesView : public gtk_tree::TreeAdapter::Delegate { // Filter the list against the text in |filter_entry_|. void UpdateFilterResults(); - // Sets which of the detailed info table is visible. - void UpdateVisibleDetailedInfo(GtkWidget* table); - // Callbacks for user actions filtering the list. static void OnFilterEntryActivated(GtkEntry* entry, CookiesView* window); static void OnFilterEntryChanged(GtkEditable* editable, CookiesView* window); @@ -149,35 +108,7 @@ class CookiesView : public gtk_tree::TreeAdapter::Delegate { GtkWidget* tree_; GtkTreeSelection* selection_; - // The cookie details widgets. - GtkWidget* cookie_details_table_; - GtkWidget* cookie_name_entry_; - GtkWidget* cookie_content_entry_; - GtkWidget* cookie_domain_entry_; - GtkWidget* cookie_path_entry_; - GtkWidget* cookie_send_for_entry_; - GtkWidget* cookie_created_entry_; - GtkWidget* cookie_expires_entry_; - - // The database details widgets. - GtkWidget* database_details_table_; - GtkWidget* database_name_entry_; - GtkWidget* database_description_entry_; - GtkWidget* database_size_entry_; - GtkWidget* database_last_modified_entry_; - - // The local storage details widgets. - GtkWidget* local_storage_details_table_; - GtkWidget* local_storage_origin_entry_; - GtkWidget* local_storage_size_entry_; - GtkWidget* local_storage_last_modified_entry_; - - // The appcache details widgets. - GtkWidget* appcache_details_table_; - GtkWidget* appcache_manifest_entry_; - GtkWidget* appcache_size_entry_; - GtkWidget* appcache_created_entry_; - GtkWidget* appcache_last_accessed_entry_; + scoped_ptr<CookieDisplayGtk> cookie_display_gtk_; // The profile and related helpers. Profile* profile_; diff --git a/chrome/browser/gtk/options/cookies_view_unittest.cc b/chrome/browser/gtk/options/cookies_view_unittest.cc index 0c12dfd..b79903e 100644 --- a/chrome/browser/gtk/options/cookies_view_unittest.cc +++ b/chrome/browser/gtk/options/cookies_view_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/browser/mock_browsing_data_appcache_helper.h" #include "chrome/browser/mock_browsing_data_database_helper.h" #include "chrome/browser/mock_browsing_data_local_storage_helper.h" +#include "chrome/browser/gtk/cookie_display_gtk.h" #include "chrome/browser/net/url_request_context_getter.h" #include "chrome/test/testing_profile.h" #include "net/url_request/url_request_context.h" @@ -44,45 +45,59 @@ class CookiesViewTest : public testing::Test { const CookiesView& cookies_view) { // Cookies EXPECT_EQ(expected_cookies, - GTK_WIDGET_SENSITIVE(cookies_view.cookie_name_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + cookie_name_entry_)); EXPECT_EQ(expected_cookies, - GTK_WIDGET_SENSITIVE(cookies_view.cookie_content_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + cookie_content_entry_)); EXPECT_EQ(expected_cookies, - GTK_WIDGET_SENSITIVE(cookies_view.cookie_domain_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + cookie_domain_entry_)); EXPECT_EQ(expected_cookies, - GTK_WIDGET_SENSITIVE(cookies_view.cookie_path_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + cookie_path_entry_)); EXPECT_EQ(expected_cookies, - GTK_WIDGET_SENSITIVE(cookies_view.cookie_send_for_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + cookie_send_for_entry_)); EXPECT_EQ(expected_cookies, - GTK_WIDGET_SENSITIVE(cookies_view.cookie_created_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + cookie_created_entry_)); EXPECT_EQ(expected_cookies, - GTK_WIDGET_SENSITIVE(cookies_view.cookie_expires_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + cookie_expires_entry_)); // Database EXPECT_EQ(expected_database, - GTK_WIDGET_SENSITIVE(cookies_view.database_description_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + database_description_entry_)); EXPECT_EQ(expected_database, - GTK_WIDGET_SENSITIVE(cookies_view.database_size_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + database_size_entry_)); EXPECT_EQ(expected_database, - GTK_WIDGET_SENSITIVE( - cookies_view.database_last_modified_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + database_last_modified_entry_)); // Local Storage EXPECT_EQ(expected_local_storage, - GTK_WIDGET_SENSITIVE(cookies_view.local_storage_origin_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + local_storage_origin_entry_)); EXPECT_EQ(expected_local_storage, - GTK_WIDGET_SENSITIVE(cookies_view.local_storage_size_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + local_storage_size_entry_)); EXPECT_EQ(expected_local_storage, - GTK_WIDGET_SENSITIVE( - cookies_view.local_storage_last_modified_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + local_storage_last_modified_entry_)); // AppCache EXPECT_EQ(expected_appcache, - GTK_WIDGET_SENSITIVE(cookies_view.appcache_manifest_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + appcache_manifest_entry_)); EXPECT_EQ(expected_appcache, - GTK_WIDGET_SENSITIVE(cookies_view.appcache_size_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + appcache_size_entry_)); EXPECT_EQ(expected_appcache, - GTK_WIDGET_SENSITIVE(cookies_view.appcache_created_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + appcache_created_entry_)); EXPECT_EQ(expected_appcache, - GTK_WIDGET_SENSITIVE( - cookies_view.appcache_last_accessed_entry_)); + GTK_WIDGET_SENSITIVE(cookies_view.cookie_display_gtk_-> + appcache_last_accessed_entry_)); } // Get the cookie names in the cookie list, as a comma seperated string. |