| Index: chrome/browser/views/options/cookies_view.cc
|
| ===================================================================
|
| --- chrome/browser/views/options/cookies_view.cc (revision 40156)
|
| +++ chrome/browser/views/options/cookies_view.cc (working copy)
|
| @@ -14,6 +14,7 @@
|
| #include "base/string_util.h"
|
| #include "chrome/browser/cookies_tree_model.h"
|
| #include "chrome/browser/profile.h"
|
| +#include "chrome/browser/views/appcache_info_view.h"
|
| #include "chrome/browser/views/cookie_info_view.h"
|
| #include "chrome/browser/views/database_info_view.h"
|
| #include "chrome/browser/views/local_storage_info_view.h"
|
| @@ -63,6 +64,28 @@
|
| }
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| +// CookiesView::InfoPanelView
|
| +// Overridden to handle layout of the various info views.
|
| +//
|
| +// This view is a child of the CookiesView and participates
|
| +// in its GridLayout. The various info views are all children
|
| +// of this view. Only one child is expected to be visible at a time.
|
| +
|
| +class CookiesView::InfoPanelView : public views::View {
|
| + public:
|
| + virtual void Layout() {
|
| + int child_count = GetChildViewCount();
|
| + for (int i = 0; i < child_count; ++i)
|
| + GetChildViewAt(i)->SetBounds(0, 0, width(), height());
|
| + }
|
| +
|
| + virtual gfx::Size GetPreferredSize() {
|
| + DCHECK(GetChildViewCount() > 0);
|
| + return GetChildViewAt(0)->GetPreferredSize();
|
| + }
|
| +};
|
| +
|
| +///////////////////////////////////////////////////////////////////////////////
|
| // CookiesView, public:
|
|
|
| // static
|
| @@ -204,6 +227,10 @@
|
| UpdateVisibleDetailedInfo(local_storage_info_view_);
|
| local_storage_info_view_->SetLocalStorageInfo(
|
| *detailed_info.local_storage_info);
|
| + } else if (detailed_info.node_type ==
|
| + CookieTreeNode::DetailedInfo::TYPE_APPCACHE) {
|
| + UpdateVisibleDetailedInfo(appcache_info_view_);
|
| + appcache_info_view_->SetAppCacheInfo(detailed_info.appcache_info);
|
| } else {
|
| UpdateVisibleDetailedInfo(cookie_info_view_);
|
| cookie_info_view_->ClearCookieDisplay();
|
| @@ -236,9 +263,11 @@
|
| clear_search_button_(NULL),
|
| description_label_(NULL),
|
| cookies_tree_(NULL),
|
| + info_panel_(NULL),
|
| cookie_info_view_(NULL),
|
| database_info_view_(NULL),
|
| local_storage_info_view_(NULL),
|
| + appcache_info_view_(NULL),
|
| remove_button_(NULL),
|
| remove_all_button_(NULL),
|
| profile_(profile),
|
| @@ -258,11 +287,20 @@
|
| description_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
|
| cookies_tree_model_.reset(new CookiesTreeModel(profile_,
|
| new BrowsingDataDatabaseHelper(profile_),
|
| - new BrowsingDataLocalStorageHelper(profile_)));
|
| + new BrowsingDataLocalStorageHelper(profile_),
|
| + new BrowsingDataAppCacheHelper(profile_)));
|
| cookies_tree_model_->AddObserver(this);
|
| +
|
| + info_panel_ = new InfoPanelView;
|
| cookie_info_view_ = new CookieInfoView(false);
|
| database_info_view_ = new DatabaseInfoView;
|
| local_storage_info_view_ = new LocalStorageInfoView;
|
| + appcache_info_view_ = new AppCacheInfoView;
|
| + info_panel_->AddChildView(cookie_info_view_);
|
| + info_panel_->AddChildView(database_info_view_);
|
| + info_panel_->AddChildView(local_storage_info_view_);
|
| + info_panel_->AddChildView(appcache_info_view_);
|
| +
|
| cookies_tree_ = new CookiesTreeView(cookies_tree_model_.get());
|
| remove_button_ = new views::NativeButton(
|
| this, l10n_util::GetString(IDS_COOKIES_REMOVE_LABEL));
|
| @@ -310,14 +348,8 @@
|
|
|
| layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
|
| layout->StartRow(0, single_column_layout_id);
|
| - layout->AddView(cookie_info_view_, 1, 2);
|
| + layout->AddView(info_panel_);
|
|
|
| - layout->StartRow(0, single_column_layout_id);
|
| - layout->AddView(database_info_view_);
|
| -
|
| - layout->StartRow(0, single_column_layout_id);
|
| - layout->AddView(local_storage_info_view_);
|
| -
|
| // Add the Remove/Remove All buttons to the ClientView
|
| View* parent = GetParent();
|
| parent->AddChildView(remove_button_);
|
| @@ -352,4 +384,5 @@
|
| cookie_info_view_->SetVisible(view == cookie_info_view_);
|
| database_info_view_->SetVisible(view == database_info_view_);
|
| local_storage_info_view_->SetVisible(view == local_storage_info_view_);
|
| + appcache_info_view_->SetVisible(view == appcache_info_view_);
|
| }
|
|
|