diff options
20 files changed, 56 insertions, 908 deletions
diff --git a/chrome/browser/browsing_data_quota_helper.cc b/chrome/browser/browsing_data_quota_helper.cc deleted file mode 100644 index f1ea58c..0000000 --- a/chrome/browser/browsing_data_quota_helper.cc +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2011 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/browsing_data_quota_helper.h" - -BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo() - : temporary_usage(0), - persistent_usage(0) {} - -BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo(const std::string& host) - : host(host), - temporary_usage(0), - persistent_usage(0) {} - -BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo(const std::string& host, - int64 temporary_usage, - int64 persistent_usage) - : host(host), - temporary_usage(temporary_usage), - persistent_usage(persistent_usage) {} - -BrowsingDataQuotaHelper::QuotaInfo::~QuotaInfo() {} - -// static -void BrowsingDataQuotaHelperDeleter::Destruct( - const BrowsingDataQuotaHelper* helper) { - helper->io_thread_->DeleteSoon(FROM_HERE, helper); -} - -BrowsingDataQuotaHelper::BrowsingDataQuotaHelper( - base::MessageLoopProxy* io_thread) - : io_thread_(io_thread) { -} - -BrowsingDataQuotaHelper::~BrowsingDataQuotaHelper() { -} - -bool operator <(const BrowsingDataQuotaHelper::QuotaInfo& lhs, - const BrowsingDataQuotaHelper::QuotaInfo& rhs) { - if (lhs.host != rhs.host) - return lhs.host < rhs.host; - if (lhs.temporary_usage != rhs.temporary_usage) - return lhs.temporary_usage < rhs.temporary_usage; - return lhs.persistent_usage < rhs.persistent_usage; -} - -bool operator ==(const BrowsingDataQuotaHelper::QuotaInfo& lhs, - const BrowsingDataQuotaHelper::QuotaInfo& rhs) { - return lhs.host == rhs.host && - lhs.temporary_usage == rhs.temporary_usage && - lhs.persistent_usage == rhs.persistent_usage; -} diff --git a/chrome/browser/browsing_data_quota_helper.h b/chrome/browser/browsing_data_quota_helper.h deleted file mode 100644 index 2ed0c1b..0000000 --- a/chrome/browser/browsing_data_quota_helper.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2011 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_BROWSING_DATA_QUOTA_HELPER_H_ -#define CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_ -#pragma once - -#include <string> -#include <vector> - -#include "base/callback_old.h" -#include "base/memory/ref_counted.h" -#include "base/message_loop_proxy.h" -#include "base/time.h" -#include "content/browser/browser_thread.h" -#include "webkit/quota/quota_types.h" - -class Profile; - -namespace quota { -class QuotaManager; -} - -class BrowsingDataQuotaHelper; - -struct BrowsingDataQuotaHelperDeleter { - static void Destruct(const BrowsingDataQuotaHelper* helper); -}; - -// This class is an interface class to bridge between Cookies Tree and Unified -// Quota System. This class provides a way to get usage and quota information -// through the instance. -// -// Call Create to create an instance for a profile and call StartFetching with -// a callback to fetch information asynchronously. If result is no longer needed -// after StartFetching, call CancelNotification to prevent callback. -// -// Parallel fetching is not allowed, a fetching task should start after end of -// previous task. All method of this class should called from UI thread. -class BrowsingDataQuotaHelper - : public base::RefCountedThreadSafe<BrowsingDataQuotaHelper, - BrowsingDataQuotaHelperDeleter> { - public: - // QuotaInfo contains host-based quota and usage information for persistent - // and temporary storage. - struct QuotaInfo { - QuotaInfo(); - explicit QuotaInfo(const std::string& host); - QuotaInfo(const std::string& host, - int64 temporary_usage, - int64 persistent_usage); - ~QuotaInfo(); - - std::string host; - int64 temporary_usage; - int64 persistent_usage; - }; - - typedef std::vector<QuotaInfo> QuotaInfoArray; - typedef Callback1<const QuotaInfoArray&>::Type FetchResultCallback; - - static BrowsingDataQuotaHelper* Create(Profile* profile); - - virtual void StartFetching(FetchResultCallback* callback) = 0; - virtual void CancelNotification() = 0; - - // We don't support deletion now. - virtual void DeleteQuotaHost(const std::string& host) {} - - protected: - explicit BrowsingDataQuotaHelper(base::MessageLoopProxy* io_thread_); - virtual ~BrowsingDataQuotaHelper(); - - private: - friend class DeleteTask<const BrowsingDataQuotaHelper>; - friend struct BrowsingDataQuotaHelperDeleter; - scoped_refptr<base::MessageLoopProxy> io_thread_; - - DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelper); -}; - -bool operator <(const BrowsingDataQuotaHelper::QuotaInfo& lhs, - const BrowsingDataQuotaHelper::QuotaInfo& rhs); -bool operator ==(const BrowsingDataQuotaHelper::QuotaInfo& lhs, - const BrowsingDataQuotaHelper::QuotaInfo& rhs); - -#endif // CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_H_ diff --git a/chrome/browser/browsing_data_quota_helper_impl.cc b/chrome/browser/browsing_data_quota_helper_impl.cc deleted file mode 100644 index a3e9e1d..0000000 --- a/chrome/browser/browsing_data_quota_helper_impl.cc +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) 2011 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/browsing_data_quota_helper_impl.h" - -#include <map> -#include <set> - -#include "base/logging.h" -#include "chrome/browser/profiles/profile.h" -#include "webkit/quota/quota_manager.h" - -// static -BrowsingDataQuotaHelper* BrowsingDataQuotaHelper::Create(Profile* profile) { - return new BrowsingDataQuotaHelperImpl( - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), - profile->GetQuotaManager()); -} - -BrowsingDataQuotaHelperImpl::BrowsingDataQuotaHelperImpl( - base::MessageLoopProxy* ui_thread, - base::MessageLoopProxy* io_thread, - quota::QuotaManager* quota_manager) - : BrowsingDataQuotaHelper(io_thread), - quota_manager_(quota_manager), - is_fetching_(false), - ui_thread_(ui_thread), - io_thread_(io_thread), - callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { - DCHECK(quota_manager); -} - -BrowsingDataQuotaHelperImpl::~BrowsingDataQuotaHelperImpl() {} - -void BrowsingDataQuotaHelperImpl::StartFetching(FetchResultCallback* callback) { - DCHECK(callback); - DCHECK(!callback_.get()); - DCHECK(!is_fetching_); - callback_.reset(callback); - quota_info_.clear(); - is_fetching_ = true; - - FetchQuotaInfo(); -} - -void BrowsingDataQuotaHelperImpl::CancelNotification() { - callback_.reset(); -} - -void BrowsingDataQuotaHelperImpl::FetchQuotaInfo() { - if (!io_thread_->BelongsToCurrentThread()) { - io_thread_->PostTask( - FROM_HERE, - NewRunnableMethod( - this, - &BrowsingDataQuotaHelperImpl::FetchQuotaInfo)); - return; - } - - quota_manager_->GetOriginsModifiedSince( - quota::kStorageTypeTemporary, - base::Time(), - callback_factory_.NewCallback( - &BrowsingDataQuotaHelperImpl::GotOrigins)); -} - -void BrowsingDataQuotaHelperImpl::GotOrigins( - const std::set<GURL>& origins, quota::StorageType type) { - for (std::set<GURL>::const_iterator itr = origins.begin(); - itr != origins.end(); - ++itr) - pending_hosts_.insert(std::make_pair(itr->host(), type)); - - DCHECK(type == quota::kStorageTypeTemporary || - type == quota::kStorageTypePersistent); - - if (type == quota::kStorageTypeTemporary) { - quota_manager_->GetOriginsModifiedSince( - quota::kStorageTypePersistent, - base::Time(), - callback_factory_.NewCallback( - &BrowsingDataQuotaHelperImpl::GotOrigins)); - } else { - // type == quota::kStorageTypePersistent - ProcessPendingHosts(); - } -} - -void BrowsingDataQuotaHelperImpl::ProcessPendingHosts() { - if (pending_hosts_.empty()) { - OnComplete(); - return; - } - - PendingHosts::iterator itr = pending_hosts_.begin(); - std::string host = itr->first; - quota::StorageType type = itr->second; - pending_hosts_.erase(itr); - GetHostUsage(host, type); -} - -void BrowsingDataQuotaHelperImpl::GetHostUsage(const std::string& host, - quota::StorageType type) { - DCHECK(quota_manager_.get()); - quota_manager_->GetHostUsage( - host, type, - callback_factory_.NewCallback( - &BrowsingDataQuotaHelperImpl::GotHostUsage)); -} - -void BrowsingDataQuotaHelperImpl::GotHostUsage(const std::string& host, - quota::StorageType type, - int64 usage) { - switch (type) { - case quota::kStorageTypeTemporary: - quota_info_[host].temporary_usage = usage; - break; - case quota::kStorageTypePersistent: - quota_info_[host].persistent_usage = usage; - break; - default: - NOTREACHED(); - } - ProcessPendingHosts(); -} - -void BrowsingDataQuotaHelperImpl::OnComplete() { - // Check if CancelNotification was called - if (!callback_.get()) - return; - - if (!ui_thread_->BelongsToCurrentThread()) { - ui_thread_->PostTask( - FROM_HERE, - NewRunnableMethod( - this, - &BrowsingDataQuotaHelperImpl::OnComplete)); - return; - } - - is_fetching_ = false; - - QuotaInfoArray result; - result.reserve(quota_info_.size()); - - for (std::map<std::string, QuotaInfo>::iterator itr = quota_info_.begin(); - itr != quota_info_.end(); - ++itr) { - QuotaInfo* info = &itr->second; - // Skip unused entries - if (info->temporary_usage <= 0 && - info->persistent_usage <= 0) - continue; - - info->host = itr->first; - result.push_back(*info); - } - - callback_->Run(result); - callback_.reset(); -} diff --git a/chrome/browser/browsing_data_quota_helper_impl.h b/chrome/browser/browsing_data_quota_helper_impl.h deleted file mode 100644 index 83e4516..0000000 --- a/chrome/browser/browsing_data_quota_helper_impl.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2011 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_BROWSING_DATA_QUOTA_HELPER_IMPL_H_ -#define CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_IMPL_H_ -#pragma once - -#include <map> -#include <set> -#include <string> -#include <utility> -#include <vector> - -#include "base/callback_old.h" -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_callback_factory.h" -#include "base/memory/scoped_ptr.h" -#include "base/time.h" -#include "chrome/browser/browsing_data_quota_helper.h" -#include "content/browser/browser_thread.h" -#include "webkit/quota/quota_types.h" - -namespace quota { -class QuotaManager; -} - -// Implementation of BrowsingDataQuotaHelper. Since a client of -// BrowsingDataQuotaHelper should live in UI thread and QuotaManager lives in -// IO thread, we have to communicate over thread using PostTask. -class BrowsingDataQuotaHelperImpl : public BrowsingDataQuotaHelper { - public: - virtual void StartFetching(FetchResultCallback* callback) OVERRIDE; - virtual void CancelNotification() OVERRIDE; - - private: - void FetchQuotaInfo(); - void OnComplete(); - - void GetHostUsage(const std::string& host, quota::StorageType type); - void ProcessPendingHosts(); - - // Callback function for GetOriginModifiedSince. - void GotOrigins(const std::set<GURL>& origins, quota::StorageType type); - - // Callback function for GetHostUsage. - void GotHostUsage(const std::string& host, - quota::StorageType type, - int64 usage); - - explicit BrowsingDataQuotaHelperImpl(base::MessageLoopProxy* ui_thread, - base::MessageLoopProxy* io_thread, - quota::QuotaManager* quota_manager); - virtual ~BrowsingDataQuotaHelperImpl(); - - scoped_refptr<quota::QuotaManager> quota_manager_; - scoped_ptr<FetchResultCallback> callback_; - - typedef std::set<std::pair<std::string, quota::StorageType> > PendingHosts; - PendingHosts pending_hosts_; - std::map<std::string, QuotaInfo> quota_info_; - - bool is_fetching_; - - scoped_refptr<base::MessageLoopProxy> ui_thread_; - scoped_refptr<base::MessageLoopProxy> io_thread_; - base::ScopedCallbackFactory<BrowsingDataQuotaHelperImpl> callback_factory_; - - friend class BrowsingDataQuotaHelper; - friend class BrowsingDataQuotaHelperTest; - - DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelperImpl); -}; - -#endif // CHROME_BROWSER_BROWSING_DATA_QUOTA_HELPER_IMPL_H_ diff --git a/chrome/browser/browsing_data_quota_helper_unittest.cc b/chrome/browser/browsing_data_quota_helper_unittest.cc deleted file mode 100644 index d22718d..0000000 --- a/chrome/browser/browsing_data_quota_helper_unittest.cc +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) 2011 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 "testing/gtest/include/gtest/gtest.h" - -#include "base/memory/scoped_callback_factory.h" -#include "base/message_loop_proxy.h" -#include "base/scoped_temp_dir.h" -#include "chrome/browser/browsing_data_quota_helper_impl.h" -#include "webkit/quota/mock_storage_client.h" -#include "webkit/quota/quota_manager.h" - -class BrowsingDataQuotaHelperTest : public testing::Test { - public: - typedef BrowsingDataQuotaHelper::QuotaInfo QuotaInfo; - typedef BrowsingDataQuotaHelper::QuotaInfoArray QuotaInfoArray; - - BrowsingDataQuotaHelperTest() - : ui_thread_(BrowserThread::UI, &message_loop_), - db_thread_(BrowserThread::DB, &message_loop_), - io_thread_(BrowserThread::IO, &message_loop_), - fetching_completed_(true), - callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} - - virtual ~BrowsingDataQuotaHelperTest() {} - - virtual void SetUp() OVERRIDE { - EXPECT_TRUE(dir_.CreateUniqueTempDir()); - quota_manager_ = new quota::QuotaManager( - false, dir_.path(), - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), - NULL); - helper_ = new BrowsingDataQuotaHelperImpl( - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), - quota_manager_); - } - - virtual void TearDown() OVERRIDE { - helper_ = NULL; - quota_manager_ = NULL; - quota_info_.clear(); - } - - protected: - const QuotaInfoArray& quota_info() const { - return quota_info_; - } - - bool fetching_completed() const { - return fetching_completed_; - } - - void StartFetching() { - fetching_completed_ = false; - helper_->StartFetching( - callback_factory_.NewCallback( - &BrowsingDataQuotaHelperTest::FetchCompleted)); - } - - void RegisterClient(const quota::MockOriginData* data, std::size_t data_len) { - quota::MockStorageClient* client = - new quota::MockStorageClient( - quota_manager_->proxy(), data, data_len); - quota_manager_->proxy()->RegisterClient(client); - client->TouchAllOriginsAndNotify(); - } - - private: - void FetchCompleted(const QuotaInfoArray& quota_info) { - quota_info_ = quota_info; - fetching_completed_ = true; - } - - MessageLoop message_loop_; - BrowserThread ui_thread_; - BrowserThread db_thread_; - BrowserThread io_thread_; - scoped_refptr<quota::QuotaManager> quota_manager_; - - ScopedTempDir dir_; - scoped_refptr<BrowsingDataQuotaHelper> helper_; - - bool fetching_completed_; - QuotaInfoArray quota_info_; - base::ScopedCallbackFactory<BrowsingDataQuotaHelperTest> callback_factory_; - - DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelperTest); -}; - -TEST_F(BrowsingDataQuotaHelperTest, Empty) { - StartFetching(); - MessageLoop::current()->RunAllPending(); - EXPECT_TRUE(fetching_completed()); - EXPECT_TRUE(quota_info().empty()); -} - -TEST_F(BrowsingDataQuotaHelperTest, FetchData) { - const quota::MockOriginData kOrigins[] = { - {"http://example.com/", quota::kStorageTypeTemporary, 1}, - {"https://example.com/", quota::kStorageTypeTemporary, 10}, - {"http://example.com/", quota::kStorageTypePersistent, 100}, - {"http://example2.com/", quota::kStorageTypeTemporary, 1000}, - }; - - RegisterClient(kOrigins, arraysize(kOrigins)); - StartFetching(); - MessageLoop::current()->RunAllPending(); - EXPECT_TRUE(fetching_completed()); - - std::set<QuotaInfo> expected, actual; - actual.insert(quota_info().begin(), quota_info().end()); - expected.insert(QuotaInfo("example.com", 11, 100)); - expected.insert(QuotaInfo("example2.com", 1000, 0)); - EXPECT_TRUE(expected == actual); -} diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc index 186fa485..3950da2 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.cc +++ b/chrome/browser/content_settings/tab_specific_content_settings.cc @@ -526,6 +526,5 @@ TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() { appcaches_->Clone(), indexed_dbs_->Clone(), file_systems_->Clone(), - NULL, true); } diff --git a/chrome/browser/cookies_tree_model.cc b/chrome/browser/cookies_tree_model.cc index e626f66..8a001f6 100644 --- a/chrome/browser/cookies_tree_model.cc +++ b/chrome/browser/cookies_tree_model.cc @@ -68,7 +68,7 @@ void CookieTreeCookieNode::DeleteStoredObjects() { CookieTreeNode::DetailedInfo CookieTreeCookieNode::GetDetailedInfo() const { return DetailedInfo(parent()->parent()->GetTitle(), DetailedInfo::TYPE_COOKIE, - cookie_, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + cookie_, NULL, NULL, NULL, NULL, NULL, NULL); } namespace { @@ -148,7 +148,7 @@ void CookieTreeAppCacheNode::DeleteStoredObjects() { CookieTreeNode::DetailedInfo CookieTreeAppCacheNode::GetDetailedInfo() const { return DetailedInfo(parent()->parent()->GetTitle(), DetailedInfo::TYPE_APPCACHE, - NULL, NULL, NULL, NULL, appcache_info_, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, appcache_info_, NULL, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -172,7 +172,7 @@ void CookieTreeDatabaseNode::DeleteStoredObjects() { CookieTreeNode::DetailedInfo CookieTreeDatabaseNode::GetDetailedInfo() const { return DetailedInfo(parent()->parent()->GetTitle(), DetailedInfo::TYPE_DATABASE, - NULL, database_info_, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, database_info_, NULL, NULL, NULL, NULL, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -198,8 +198,7 @@ CookieTreeNode::DetailedInfo CookieTreeLocalStorageNode::GetDetailedInfo() const { return DetailedInfo(parent()->parent()->GetTitle(), DetailedInfo::TYPE_LOCAL_STORAGE, - NULL, NULL, local_storage_info_, NULL, NULL, NULL, NULL, - NULL); + NULL, NULL, local_storage_info_, NULL, NULL, NULL, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -221,7 +220,7 @@ CookieTreeSessionStorageNode::GetDetailedInfo() const { return DetailedInfo(parent()->parent()->GetTitle(), DetailedInfo::TYPE_SESSION_STORAGE, NULL, NULL, NULL, session_storage_info_, NULL, NULL, - NULL, NULL); + NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -246,8 +245,7 @@ void CookieTreeIndexedDBNode::DeleteStoredObjects() { CookieTreeNode::DetailedInfo CookieTreeIndexedDBNode::GetDetailedInfo() const { return DetailedInfo(parent()->parent()->GetTitle(), DetailedInfo::TYPE_INDEXED_DB, - NULL, NULL, NULL, NULL, NULL, indexed_db_info_, NULL, - NULL); + NULL, NULL, NULL, NULL, NULL, indexed_db_info_, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -270,29 +268,7 @@ void CookieTreeFileSystemNode::DeleteStoredObjects() { CookieTreeNode::DetailedInfo CookieTreeFileSystemNode::GetDetailedInfo() const { return DetailedInfo(parent()->parent()->GetTitle(), DetailedInfo::TYPE_FILE_SYSTEM, - NULL, NULL, NULL, NULL, NULL, NULL, file_system_info_, - NULL); -} - -/////////////////////////////////////////////////////////////////////////////// -// CookieTreeQuotaNode, public: - -CookieTreeQuotaNode::CookieTreeQuotaNode( - BrowsingDataQuotaHelper::QuotaInfo* quota_info) - : CookieTreeNode(UTF8ToUTF16(quota_info->host)), - quota_info_(quota_info) { -} - -CookieTreeQuotaNode::~CookieTreeQuotaNode() {} - -void CookieTreeQuotaNode::DeleteStoredObjects() { - GetModel()->quota_helper_->DeleteQuotaHost(quota_info_->host); -} - -CookieTreeNode::DetailedInfo CookieTreeQuotaNode::GetDetailedInfo() const { - return DetailedInfo(parent()->parent()->GetTitle(), - DetailedInfo::TYPE_QUOTA, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, quota_info_); + NULL, NULL, NULL, NULL, NULL, NULL, file_system_info_); } /////////////////////////////////////////////////////////////////////////////// @@ -334,7 +310,7 @@ CookiesTreeModel* CookieTreeRootNode::GetModel() const { CookieTreeNode::DetailedInfo CookieTreeRootNode::GetDetailedInfo() const { return DetailedInfo(string16(), DetailedInfo::TYPE_ROOT, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -355,7 +331,6 @@ CookieTreeOriginNode::CookieTreeOriginNode(const GURL& url) appcaches_child_(NULL), indexed_dbs_child_(NULL), file_systems_child_(NULL), - quota_child_(NULL), url_(url) {} CookieTreeOriginNode::~CookieTreeOriginNode() {} @@ -363,7 +338,7 @@ CookieTreeOriginNode::~CookieTreeOriginNode() {} CookieTreeNode::DetailedInfo CookieTreeOriginNode::GetDetailedInfo() const { return DetailedInfo(GetTitle(), DetailedInfo::TYPE_ORIGIN, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL); } CookieTreeCookiesNode* CookieTreeOriginNode::GetOrCreateCookiesNode() { @@ -424,15 +399,6 @@ CookieTreeFileSystemsNode* CookieTreeOriginNode::GetOrCreateFileSystemsNode() { return file_systems_child_; } -CookieTreeQuotaNode* CookieTreeOriginNode::UpdateOrCreateQuotaNode( - BrowsingDataQuotaHelper::QuotaInfo* quota_info) { - if (quota_child_) - return quota_child_; - quota_child_ = new CookieTreeQuotaNode(quota_info); - AddChildSortedByTitle(quota_child_); - return quota_child_; -} - void CookieTreeOriginNode::CreateContentException( HostContentSettingsMap* content_settings, ContentSetting setting) const { if (CanCreateContentException()) { @@ -461,7 +427,7 @@ CookieTreeCookiesNode::~CookieTreeCookiesNode() { CookieTreeNode::DetailedInfo CookieTreeCookiesNode::GetDetailedInfo() const { return DetailedInfo(parent()->GetTitle(), DetailedInfo::TYPE_COOKIES, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -477,7 +443,7 @@ CookieTreeAppCachesNode::~CookieTreeAppCachesNode() {} CookieTreeNode::DetailedInfo CookieTreeAppCachesNode::GetDetailedInfo() const { return DetailedInfo(parent()->GetTitle(), DetailedInfo::TYPE_APPCACHES, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -492,7 +458,7 @@ CookieTreeDatabasesNode::~CookieTreeDatabasesNode() {} CookieTreeNode::DetailedInfo CookieTreeDatabasesNode::GetDetailedInfo() const { return DetailedInfo(parent()->GetTitle(), DetailedInfo::TYPE_DATABASES, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -508,7 +474,7 @@ CookieTreeNode::DetailedInfo CookieTreeLocalStoragesNode::GetDetailedInfo() const { return DetailedInfo(parent()->GetTitle(), DetailedInfo::TYPE_LOCAL_STORAGES, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -524,7 +490,7 @@ CookieTreeNode::DetailedInfo CookieTreeSessionStoragesNode::GetDetailedInfo() const { return DetailedInfo(parent()->GetTitle(), DetailedInfo::TYPE_SESSION_STORAGES, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -540,7 +506,7 @@ CookieTreeNode::DetailedInfo CookieTreeIndexedDBsNode::GetDetailedInfo() const { return DetailedInfo(parent()->GetTitle(), DetailedInfo::TYPE_INDEXED_DBS, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -556,7 +522,7 @@ CookieTreeNode::DetailedInfo CookieTreeFileSystemsNode::GetDetailedInfo() const { return DetailedInfo(parent()->GetTitle(), DetailedInfo::TYPE_FILE_SYSTEMS, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -592,7 +558,6 @@ CookiesTreeModel::CookiesTreeModel( BrowsingDataAppCacheHelper* appcache_helper, BrowsingDataIndexedDBHelper* indexed_db_helper, BrowsingDataFileSystemHelper* file_system_helper, - BrowsingDataQuotaHelper* quota_helper, bool use_cookie_source) : ALLOW_THIS_IN_INITIALIZER_LIST(ui::TreeNodeModel<CookieTreeNode>( new CookieTreeRootNode(this))), @@ -603,7 +568,6 @@ CookiesTreeModel::CookiesTreeModel( session_storage_helper_(session_storage_helper), indexed_db_helper_(indexed_db_helper), file_system_helper_(file_system_helper), - quota_helper_(quota_helper), batch_update_(0), use_cookie_source_(use_cookie_source) { LoadCookies(); @@ -634,11 +598,6 @@ CookiesTreeModel::CookiesTreeModel( file_system_helper_->StartFetching(NewCallback( this, &CookiesTreeModel::OnFileSystemModelInfoLoaded)); } - - if (quota_helper_) { - quota_helper_->StartFetching(NewCallback( - this, &CookiesTreeModel::OnQuotaModelInfoLoaded)); - } } CookiesTreeModel::~CookiesTreeModel() { @@ -652,8 +611,6 @@ CookiesTreeModel::~CookiesTreeModel() { indexed_db_helper_->CancelNotification(); if (file_system_helper_) file_system_helper_->CancelNotification(); - if (quota_helper_) - quota_helper_->CancelNotification(); } /////////////////////////////////////////////////////////////////////////////// @@ -693,8 +650,6 @@ int CookiesTreeModel::GetIconIndex(ui::TreeModelNode* node) { return DATABASE; // ditto case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: return DATABASE; // ditto - case CookieTreeNode::DetailedInfo::TYPE_QUOTA: - return -1; default: break; } @@ -771,7 +726,6 @@ void CookiesTreeModel::UpdateSearchResults(const std::wstring& filter) { PopulateAppCacheInfoWithFilter(filter); PopulateIndexedDBInfoWithFilter(filter); PopulateFileSystemInfoWithFilter(filter); - PopulateQuotaInfoWithFilter(filter); NotifyObserverTreeNodeChanged(root); NotifyObserverEndBatch(); } @@ -990,32 +944,6 @@ void CookiesTreeModel::PopulateFileSystemInfoWithFilter( NotifyObserverEndBatch(); } -void CookiesTreeModel::OnQuotaModelInfoLoaded( - const QuotaInfoArray& quota_info) { - quota_info_list_ = quota_info; - PopulateQuotaInfoWithFilter(std::wstring()); -} - -void CookiesTreeModel::PopulateQuotaInfoWithFilter( - const std::wstring& filter) { - if (quota_info_list_.empty()) - return; - CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); - NotifyObserverBeginBatch(); - for (QuotaInfoArray::iterator quota_info = quota_info_list_.begin(); - quota_info != quota_info_list_.end(); - ++quota_info) { - if (!filter.size() || - (UTF8ToWide(quota_info->host).find(filter) != std::wstring::npos)) { - CookieTreeOriginNode* origin_node = - root->GetOrCreateOriginNode(GURL("http://" + quota_info->host)); - origin_node->UpdateOrCreateQuotaNode(&*quota_info); - } - } - NotifyObserverTreeNodeChanged(root); - NotifyObserverEndBatch(); -} - void CookiesTreeModel::NotifyObserverBeginBatch() { // Only notify the model once if we're batching in a nested manner. if (batch_update_++ == 0) { diff --git a/chrome/browser/cookies_tree_model.h b/chrome/browser/cookies_tree_model.h index bf9dcae..1f1e8448 100644 --- a/chrome/browser/cookies_tree_model.h +++ b/chrome/browser/cookies_tree_model.h @@ -21,7 +21,6 @@ #include "chrome/browser/browsing_data_file_system_helper.h" #include "chrome/browser/browsing_data_indexed_db_helper.h" #include "chrome/browser/browsing_data_local_storage_helper.h" -#include "chrome/browser/browsing_data_quota_helper.h" #include "chrome/common/content_settings.h" #include "net/base/cookie_monster.h" #include "ui/base/models/tree_node_model.h" @@ -37,7 +36,6 @@ class CookieTreeFileSystemsNode; class CookieTreeFileSystemNode; class CookieTreeLocalStorageNode; class CookieTreeLocalStoragesNode; -class CookieTreeQuotaNode; class CookieTreeSessionStorageNode; class CookieTreeSessionStoragesNode; class CookieTreeIndexedDBNode; @@ -71,9 +69,8 @@ class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { TYPE_APPCACHE, // This is used for CookieTreeAppCacheNode. TYPE_INDEXED_DBS, // This is used for CookieTreeIndexedDBsNode. TYPE_INDEXED_DB, // This is used for CookieTreeIndexedDBNode. - TYPE_FILE_SYSTEMS, // This is used for CookieTreeFileSystemsNode. - TYPE_FILE_SYSTEM, // This is used for CookieTreeFileSystemNode. - TYPE_QUOTA, // This is used for CookieTreeQuotaNode. + TYPE_FILE_SYSTEMS, // This is used for CookieTreeFileSystemsNode. + TYPE_FILE_SYSTEM, // This is used for CookieTreeFileSystemNode. }; // TODO(viettrungluu): Figure out whether we want to store |origin| as a @@ -88,8 +85,7 @@ class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { session_storage_info, const appcache::AppCacheInfo* appcache_info, const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info, - const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info, - const BrowsingDataQuotaHelper::QuotaInfo* quota_info) + const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info) : origin(UTF16ToWideHack(origin)), node_type(node_type), cookie(cookie), @@ -98,15 +94,13 @@ class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { session_storage_info(session_storage_info), appcache_info(appcache_info), indexed_db_info(indexed_db_info), - file_system_info(file_system_info), - quota_info(quota_info) { + file_system_info(file_system_info) { DCHECK((node_type != TYPE_DATABASE) || database_info); DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info); DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info); DCHECK((node_type != TYPE_APPCACHE) || appcache_info); DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info); DCHECK((node_type != TYPE_FILE_SYSTEM) || file_system_info); - DCHECK((node_type != TYPE_QUOTA) || quota_info); } #if !defined(WCHAR_T_IS_UTF16) DetailedInfo(const std::wstring& origin, NodeType node_type, @@ -118,8 +112,7 @@ class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { session_storage_info, const appcache::AppCacheInfo* appcache_info, const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info, - const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info, - const BrowsingDataQuotaHelper::QuotaInfo* quota_info) + const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info) : origin(origin), node_type(node_type), cookie(cookie), @@ -128,15 +121,13 @@ class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { session_storage_info(session_storage_info), appcache_info(appcache_info), indexed_db_info(indexed_db_info), - file_system_info(file_system_info), - quota_info(quota_info) { + file_system_info(file_system_info) { DCHECK((node_type != TYPE_DATABASE) || database_info); DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info); DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info); DCHECK((node_type != TYPE_APPCACHE) || appcache_info); DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info); DCHECK((node_type != TYPE_FILE_SYSTEM) || file_system_info); - DCHECK((node_type != TYPE_QUOTA) || quota_info); } #endif @@ -150,7 +141,6 @@ class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { const appcache::AppCacheInfo* appcache_info; const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; - const BrowsingDataQuotaHelper::QuotaInfo* quota_info; }; CookieTreeNode() {} @@ -221,8 +211,6 @@ class CookieTreeOriginNode : public CookieTreeNode { CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); - CookieTreeQuotaNode* UpdateOrCreateQuotaNode( - BrowsingDataQuotaHelper::QuotaInfo* quota_info); // Creates an content exception for this origin of type // CONTENT_SETTINGS_TYPE_COOKIES. @@ -245,7 +233,6 @@ class CookieTreeOriginNode : public CookieTreeNode { CookieTreeAppCachesNode* appcaches_child_; CookieTreeIndexedDBsNode* indexed_dbs_child_; CookieTreeFileSystemsNode* file_systems_child_; - CookieTreeQuotaNode* quota_child_; // The URL for which this node was initially created. GURL url_; @@ -511,24 +498,6 @@ class CookieTreeIndexedDBsNode : public CookieTreeNode { DISALLOW_COPY_AND_ASSIGN(CookieTreeIndexedDBsNode); }; -// CookieTreeQuotaNode -------------------------------------------------- -class CookieTreeQuotaNode : public CookieTreeNode { - public: - // Does not take ownership of quota_info, and quota_info should remain valid - // at least as long as the CookieTreeQuotaNode is valid. - explicit CookieTreeQuotaNode(BrowsingDataQuotaHelper::QuotaInfo* quota_info); - virtual ~CookieTreeQuotaNode(); - - virtual void DeleteStoredObjects(); - virtual DetailedInfo GetDetailedInfo() const; - - private: - // quota_info_ is not owned by the node, and is expected to remain valid as - // long as the CookieTreeQuotaNode is valid. - BrowsingDataQuotaHelper::QuotaInfo* quota_info_; - - DISALLOW_COPY_AND_ASSIGN(CookieTreeQuotaNode); -}; // CookiesTreeModel ----------------------------------------------------------- class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { @@ -552,7 +521,6 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { BrowsingDataAppCacheHelper* appcache_helper, BrowsingDataIndexedDBHelper* indexed_db_helper, BrowsingDataFileSystemHelper* file_system_helper, - BrowsingDataQuotaHelper* quota_helper, bool use_cookie_source); virtual ~CookiesTreeModel(); @@ -597,7 +565,6 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { IndexedDBInfoList; typedef std::vector<BrowsingDataFileSystemHelper::FileSystemInfo> FileSystemInfoList; - typedef std::vector<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoArray; void LoadCookies(); void LoadCookiesWithFilter(const std::wstring& filter); @@ -612,7 +579,6 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { const IndexedDBInfoList& indexed_db_info); void OnFileSystemModelInfoLoaded( const FileSystemInfoList& file_system_info); - void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info); void PopulateAppCacheInfoWithFilter(const std::wstring& filter); void PopulateDatabaseInfoWithFilter(const std::wstring& filter); @@ -620,7 +586,6 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { void PopulateSessionStorageInfoWithFilter(const std::wstring& filter); void PopulateIndexedDBInfoWithFilter(const std::wstring& filter); void PopulateFileSystemInfoWithFilter(const std::wstring& filter); - void PopulateQuotaInfoWithFilter(const std::wstring& filter); void NotifyObserverBeginBatch(); void NotifyObserverEndBatch(); @@ -637,12 +602,10 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; - scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; LocalStorageInfoList local_storage_info_list_; LocalStorageInfoList session_storage_info_list_; IndexedDBInfoList indexed_db_info_list_; FileSystemInfoList file_system_info_list_; - QuotaInfoArray quota_info_list_; // The CookiesTreeModel maintains a separate list of observers that are // specifically of the type CookiesTreeModel::Observer. @@ -663,7 +626,6 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { friend class CookieTreeLocalStorageNode; friend class CookieTreeIndexedDBNode; friend class CookieTreeFileSystemNode; - friend class CookieTreeQuotaNode; DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); }; diff --git a/chrome/browser/cookies_tree_model_unittest.cc b/chrome/browser/cookies_tree_model_unittest.cc index feec764..20f7080 100644 --- a/chrome/browser/cookies_tree_model_unittest.cc +++ b/chrome/browser/cookies_tree_model_unittest.cc @@ -12,7 +12,6 @@ #include "chrome/browser/mock_browsing_data_database_helper.h" #include "chrome/browser/mock_browsing_data_file_system_helper.h" #include "chrome/browser/mock_browsing_data_indexed_db_helper.h" -#include "chrome/browser/mock_browsing_data_quota_helper.h" #include "chrome/browser/mock_browsing_data_local_storage_helper.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/testing_browser_process_test.h" @@ -52,8 +51,6 @@ class CookiesTreeModelTest : public TestingBrowserProcessTest { new MockBrowsingDataIndexedDBHelper(profile_.get()); mock_browsing_data_file_system_helper_ = new MockBrowsingDataFileSystemHelper(profile_.get()); - mock_browsing_data_quota_helper_ = - new MockBrowsingDataQuotaHelper(profile_.get()); } CookiesTreeModel* CreateCookiesTreeModelWithInitialSample() { @@ -68,7 +65,6 @@ class CookiesTreeModelTest : public TestingBrowserProcessTest { mock_browsing_data_appcache_helper_, mock_browsing_data_indexed_db_helper_, mock_browsing_data_file_system_helper_, - mock_browsing_data_quota_helper_, false); mock_browsing_data_database_helper_->AddDatabaseSamples(); mock_browsing_data_database_helper_->Notify(); @@ -80,13 +76,10 @@ class CookiesTreeModelTest : public TestingBrowserProcessTest { mock_browsing_data_indexed_db_helper_->Notify(); mock_browsing_data_file_system_helper_->AddFileSystemSamples(); mock_browsing_data_file_system_helper_->Notify(); - mock_browsing_data_quota_helper_->AddQuotaSamples(); - mock_browsing_data_quota_helper_->Notify(); { SCOPED_TRACE("Initial State 3 cookies, 2 databases, 2 local storages, " - "2 session storages, 2 indexed DBs, 3 filesystems, " - "2 quotas"); - // 45 because there's the root, then foo1 -> cookies -> a, + "2 session storages, 2 indexed DBs, 3 filesystems"); + // 41 because there's the root, then foo1 -> cookies -> a, // foo2 -> cookies -> b, foo3 -> cookies -> c, // dbhost1 -> database -> db1, dbhost2 -> database -> db2, // fshost1 -> filesystem -> http://fshost1:1/, @@ -97,10 +90,8 @@ class CookiesTreeModelTest : public TestingBrowserProcessTest { // host1 -> sessionstorage -> http://host1:1/, // host2 -> sessionstorage -> http://host2:2/, // idbhost1 -> indexeddb -> http://idbhost1:1/, - // idbhost2 -> indexeddb -> http://idbhost2:2/, - // quotahost1 -> quotahost1, - // quotahost2 -> quotahost2. - EXPECT_EQ(45, cookies_model->GetRoot()->GetTotalNodeCount()); + // idbhost2 -> indexeddb -> http://idbhost2:2/. + EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model)); EXPECT_EQ("http://host1:1/,http://host2:2/", GetDisplayedLocalStorages(cookies_model)); @@ -110,8 +101,6 @@ class CookiesTreeModelTest : public TestingBrowserProcessTest { GetDisplayedIndexedDBs(cookies_model)); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(cookies_model)); - EXPECT_EQ("quotahost1,quotahost2", - GetDisplayedQuotas(cookies_model)); } return cookies_model; } @@ -158,8 +147,6 @@ class CookiesTreeModelTest : public TestingBrowserProcessTest { case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: return node->GetDetailedInfo().file_system_info->origin.spec() + ","; - case CookieTreeNode::DetailedInfo::TYPE_QUOTA: - return node->GetDetailedInfo().quota_info->host + ","; default: return ""; } @@ -198,11 +185,6 @@ class CookiesTreeModelTest : public TestingBrowserProcessTest { node, CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM); } - std::string GetFileQuotaOfChildren(const CookieTreeNode* node) { - return GetNodesOfChildren( - node, CookieTreeNode::DetailedInfo::TYPE_QUOTA); - } - // Get the nodes names displayed in the view (if we had one) in the order // they are displayed, as a comma seperated string. // Ex: EXPECT_STREQ("X,Y", GetDisplayedNodes(cookies_view, type).c_str()); @@ -251,11 +233,6 @@ class CookiesTreeModelTest : public TestingBrowserProcessTest { CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM); } - std::string GetDisplayedQuotas(CookiesTreeModel* cookies_model) { - return GetDisplayedNodes(cookies_model, - CookieTreeNode::DetailedInfo::TYPE_QUOTA); - } - // Do not call on the root. void DeleteStoredObjects(CookieTreeNode* node) { node->DeleteStoredObjects(); @@ -282,8 +259,6 @@ class CookiesTreeModelTest : public TestingBrowserProcessTest { mock_browsing_data_indexed_db_helper_; scoped_refptr<MockBrowsingDataFileSystemHelper> mock_browsing_data_file_system_helper_; - scoped_refptr<MockBrowsingDataQuotaHelper> - mock_browsing_data_quota_helper_; }; TEST_F(CookiesTreeModelTest, RemoveAll) { @@ -306,8 +281,6 @@ TEST_F(CookiesTreeModelTest, RemoveAll) { GetDisplayedIndexedDBs(cookies_model.get())); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(cookies_model.get())); - EXPECT_EQ("quotahost1,quotahost2", - GetDisplayedQuotas(cookies_model.get())); } mock_browsing_data_database_helper_->Reset(); @@ -352,46 +325,10 @@ TEST_F(CookiesTreeModelTest, Remove) { // 9. `host2` // 10. `idbhost1` // 11. `idbhost2` - // 12. `quotahost1` - // 13. `quotahost2` // // Here, we'll remove them one by one, starting from the end, and // check that the state makes sense. - DeleteStoredObjects(cookies_model->GetRoot()->GetChild(13)); - { - SCOPED_TRACE("`quotahost2` removed."); - EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); - EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); - EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); - EXPECT_EQ("http://host1:1/,http://host2:2/", - GetDisplayedLocalStorages(cookies_model.get())); - EXPECT_EQ("http://host1:1/,http://host2:2/", - GetDisplayedSessionStorages(cookies_model.get())); - EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", - GetDisplayedFileSystems(cookies_model.get())); - EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", - GetDisplayedIndexedDBs(cookies_model.get())); - EXPECT_EQ("quotahost1", - GetDisplayedQuotas(cookies_model.get())); - EXPECT_EQ(43, cookies_model->GetRoot()->GetTotalNodeCount()); - } - DeleteStoredObjects(cookies_model->GetRoot()->GetChild(12)); - { - SCOPED_TRACE("`quotahost1` removed."); - EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); - EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); - EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); - EXPECT_EQ("http://host1:1/,http://host2:2/", - GetDisplayedLocalStorages(cookies_model.get())); - EXPECT_EQ("http://host1:1/,http://host2:2/", - GetDisplayedSessionStorages(cookies_model.get())); - EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", - GetDisplayedFileSystems(cookies_model.get())); - EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", - GetDisplayedIndexedDBs(cookies_model.get())); - EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); - } DeleteStoredObjects(cookies_model->GetRoot()->GetChild(11)); { SCOPED_TRACE("`idbhost2` removed."); @@ -563,7 +500,7 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { SCOPED_TRACE("First origin removed"); EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str()); EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); - // 43 because in this case, the origin remains, although the COOKIES + // 39 because in this case, the origin remains, although the COOKIES // node beneath it has been deleted. So, we have // root -> foo1 -> cookies -> a, foo2, foo3 -> cookies -> c // dbhost1 -> database -> db1, dbhost2 -> database -> db2, @@ -573,10 +510,8 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { // host1 -> localstorage -> http://host1:1/, // host2 -> localstorage -> http://host2:2/, // idbhost1 -> sessionstorage -> http://idbhost1:1/, - // idbhost2 -> sessionstorage -> http://idbhost2:2/, - // quotahost1 -> quotahost1, - // quotahost2 -> quotahost1. - EXPECT_EQ(43, cookies_model->GetRoot()->GetTotalNodeCount()); + // idbhost2 -> sessionstorage -> http://idbhost2:2/. + EXPECT_EQ(39, cookies_model->GetRoot()->GetTotalNodeCount()); EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); EXPECT_EQ("http://host1:1/,http://host2:2/", GetDisplayedLocalStorages(cookies_model.get())); @@ -586,7 +521,6 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { GetDisplayedIndexedDBs(cookies_model.get())); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(cookies_model.get())); - EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); } DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)->GetChild(0)); @@ -603,8 +537,7 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { GetDisplayedIndexedDBs(cookies_model.get())); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(cookies_model.get())); - EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); - EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); + EXPECT_EQ(37, cookies_model->GetRoot()->GetTotalNodeCount()); } DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); @@ -621,8 +554,7 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { GetDisplayedIndexedDBs(cookies_model.get())); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(cookies_model.get())); - EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); - EXPECT_EQ(39, cookies_model->GetRoot()->GetTotalNodeCount()); + EXPECT_EQ(35, cookies_model->GetRoot()->GetTotalNodeCount()); } } @@ -645,8 +577,7 @@ TEST_F(CookiesTreeModelTest, RemoveCookieNode) { GetDisplayedIndexedDBs(cookies_model.get())); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(cookies_model.get())); - EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); - // 43 because in this case, the origin remains, although the COOKIES + // 39 because in this case, the origin remains, although the COOKIES // node beneath it has been deleted. So, we have // root -> foo1 -> cookies -> a, foo2, foo3 -> cookies -> c // dbhost1 -> database -> db1, dbhost2 -> database -> db2, @@ -658,10 +589,8 @@ TEST_F(CookiesTreeModelTest, RemoveCookieNode) { // host1 -> sessionstorage -> http://host1:1/, // host2 -> sessionstorage -> http://host2:2/, // idbhost1 -> sessionstorage -> http://idbhost1:1/, - // idbhost2 -> sessionstorage -> http://idbhost2:2/, - // quotahost1 -> quotahost1, - // quotahost2 -> quotahost2. - EXPECT_EQ(43, cookies_model->GetRoot()->GetTotalNodeCount()); + // idbhost2 -> sessionstorage -> http://idbhost2:2/. + EXPECT_EQ(39, cookies_model->GetRoot()->GetTotalNodeCount()); } DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)->GetChild(0)); @@ -678,8 +607,7 @@ TEST_F(CookiesTreeModelTest, RemoveCookieNode) { GetDisplayedIndexedDBs(cookies_model.get())); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(cookies_model.get())); - EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); - EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); + EXPECT_EQ(37, cookies_model->GetRoot()->GetTotalNodeCount()); } DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); @@ -696,8 +624,7 @@ TEST_F(CookiesTreeModelTest, RemoveCookieNode) { GetDisplayedIndexedDBs(cookies_model.get())); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(cookies_model.get())); - EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); - EXPECT_EQ(39, cookies_model->GetRoot()->GetTotalNodeCount()); + EXPECT_EQ(35, cookies_model->GetRoot()->GetTotalNodeCount()); } } @@ -714,7 +641,6 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { mock_browsing_data_appcache_helper_, mock_browsing_data_indexed_db_helper_, mock_browsing_data_file_system_helper_, - mock_browsing_data_quota_helper_, false); mock_browsing_data_database_helper_->AddDatabaseSamples(); mock_browsing_data_database_helper_->Notify(); @@ -726,13 +652,10 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { mock_browsing_data_indexed_db_helper_->Notify(); mock_browsing_data_file_system_helper_->AddFileSystemSamples(); mock_browsing_data_file_system_helper_->Notify(); - mock_browsing_data_quota_helper_->AddQuotaSamples(); - mock_browsing_data_quota_helper_->Notify(); { SCOPED_TRACE("Initial State 4 cookies, 2 databases, 2 local storages, " - "2 session storages, 2 indexed DBs, 3 file systems, " - "2 quotas."); + "2 session storages, 2 indexed DBs, 3 file systems"); // 42 because there's the root, then foo1 -> cookies -> a, // foo2 -> cookies -> b, foo3 -> cookies -> c,d // dbhost1 -> database -> db1, dbhost2 -> database -> db2, @@ -743,10 +666,8 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { // host1 -> sessionstorage -> http://host1:1/, // host2 -> sessionstorage -> http://host2:2/, // idbhost1 -> sessionstorage -> http://idbhost1:1/, - // idbhost2 -> sessionstorage -> http://idbhost2:2/, - // quotahost1 -> quotahost1, - // quotahost2 -> quotahost2. - EXPECT_EQ(46, cookies_model.GetRoot()->GetTotalNodeCount()); + // idbhost2 -> sessionstorage -> http://idbhost2:2/. + EXPECT_EQ(42, cookies_model.GetRoot()->GetTotalNodeCount()); EXPECT_STREQ("A,B,C,D", GetMonsterCookies(monster).c_str()); EXPECT_STREQ("A,B,C,D", GetDisplayedCookies(&cookies_model).c_str()); EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); @@ -758,7 +679,6 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { GetDisplayedIndexedDBs(&cookies_model)); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(&cookies_model)); - EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); } DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)); { @@ -774,8 +694,7 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { GetDisplayedIndexedDBs(&cookies_model)); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(&cookies_model)); - EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); - EXPECT_EQ(42, cookies_model.GetRoot()->GetTotalNodeCount()); + EXPECT_EQ(38, cookies_model.GetRoot()->GetTotalNodeCount()); } } @@ -793,7 +712,6 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { mock_browsing_data_appcache_helper_, mock_browsing_data_indexed_db_helper_, mock_browsing_data_file_system_helper_, - mock_browsing_data_quota_helper_, false); mock_browsing_data_database_helper_->AddDatabaseSamples(); mock_browsing_data_database_helper_->Notify(); @@ -805,13 +723,10 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { mock_browsing_data_indexed_db_helper_->Notify(); mock_browsing_data_file_system_helper_->AddFileSystemSamples(); mock_browsing_data_file_system_helper_->Notify(); - mock_browsing_data_quota_helper_->AddQuotaSamples(); - mock_browsing_data_quota_helper_->Notify(); { SCOPED_TRACE("Initial State 5 cookies, 2 databases, 2 local storages, " - "2 session storages, 2 indexed DBs, 3 filesystems, " - "2 quotas."); + "2 session storages, 2 indexed DBs"); // 43 because there's the root, then foo1 -> cookies -> a, // foo2 -> cookies -> b, foo3 -> cookies -> c,d,e // dbhost1 -> database -> db1, dbhost2 -> database -> db2, @@ -823,10 +738,8 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { // host1 -> sessionstorage -> http://host1:1/, // host2 -> sessionstorage -> http://host2:2/, // idbhost1 -> sessionstorage -> http://idbhost1:1/, - // idbhost2 -> sessionstorage -> http://idbhost2:2/, - // quotahost1 -> quotahost1, - // quotahost2 -> quotahost2. - EXPECT_EQ(47, cookies_model.GetRoot()->GetTotalNodeCount()); + // idbhost2 -> sessionstorage -> http://idbhost2:2/. + EXPECT_EQ(43, cookies_model.GetRoot()->GetTotalNodeCount()); EXPECT_STREQ("A,B,C,D,E", GetMonsterCookies(monster).c_str()); EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); @@ -838,7 +751,6 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { GetDisplayedIndexedDBs(&cookies_model)); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(&cookies_model)); - EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); } DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)->GetChild(0)-> GetChild(1)); @@ -846,7 +758,7 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { SCOPED_TRACE("Middle cookie in third origin removed"); EXPECT_STREQ("A,B,C,E", GetMonsterCookies(monster).c_str()); EXPECT_STREQ("A,B,C,E", GetDisplayedCookies(&cookies_model).c_str()); - EXPECT_EQ(46, cookies_model.GetRoot()->GetTotalNodeCount()); + EXPECT_EQ(42, cookies_model.GetRoot()->GetTotalNodeCount()); EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); EXPECT_EQ("http://host1:1/,http://host2:2/", GetDisplayedLocalStorages(&cookies_model)); @@ -856,7 +768,6 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { GetDisplayedIndexedDBs(&cookies_model)); EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", GetDisplayedFileSystems(&cookies_model)); - EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); } } @@ -874,7 +785,6 @@ TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { mock_browsing_data_appcache_helper_, mock_browsing_data_indexed_db_helper_, mock_browsing_data_file_system_helper_, - mock_browsing_data_quota_helper_, false); { SCOPED_TRACE("Initial State 5 cookies"); @@ -913,7 +823,6 @@ TEST_F(CookiesTreeModelTest, OriginOrdering) { new MockBrowsingDataAppCacheHelper(profile_.get()), new MockBrowsingDataIndexedDBHelper(profile_.get()), new MockBrowsingDataFileSystemHelper(profile_.get()), - new MockBrowsingDataQuotaHelper(profile_.get()), false); { @@ -943,7 +852,6 @@ TEST_F(CookiesTreeModelTest, ContentSettings) { new MockBrowsingDataAppCacheHelper(profile_.get()), new MockBrowsingDataIndexedDBHelper(profile_.get()), new MockBrowsingDataFileSystemHelper(profile_.get()), - new MockBrowsingDataQuotaHelper(profile_.get()), false); TestingProfile profile; diff --git a/chrome/browser/mock_browsing_data_quota_helper.cc b/chrome/browser/mock_browsing_data_quota_helper.cc deleted file mode 100644 index 45d2c41..0000000 --- a/chrome/browser/mock_browsing_data_quota_helper.cc +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2011 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/mock_browsing_data_quota_helper.h" - -MockBrowsingDataQuotaHelper::MockBrowsingDataQuotaHelper(Profile* profile) - : BrowsingDataQuotaHelper(BrowserThread::GetMessageLoopProxyForThread( - BrowserThread::IO)) {} - -MockBrowsingDataQuotaHelper::~MockBrowsingDataQuotaHelper() {} - -void MockBrowsingDataQuotaHelper::StartFetching( - FetchResultCallback* callback) { - callback_.reset(callback); -} - -void MockBrowsingDataQuotaHelper::CancelNotification() { - callback_.reset(NULL); -} - -void MockBrowsingDataQuotaHelper::AddHost( - const std::string& host, - int64 temporary_usage, - int64 persistent_usage) { - response_.push_back(QuotaInfo( - host, - temporary_usage, - persistent_usage)); -} - -void MockBrowsingDataQuotaHelper::AddQuotaSamples() { - AddHost("quotahost1", 1, 2); - AddHost("quotahost2", 10, 20); -} - -void MockBrowsingDataQuotaHelper::Notify() { - CHECK(callback_.get()); - callback_->Run(response_); - callback_.reset(); - response_.clear(); -} diff --git a/chrome/browser/mock_browsing_data_quota_helper.h b/chrome/browser/mock_browsing_data_quota_helper.h deleted file mode 100644 index 333e632..0000000 --- a/chrome/browser/mock_browsing_data_quota_helper.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2011 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_MOCK_BROWSING_DATA_QUOTA_HELPER_H_ -#define CHROME_BROWSER_MOCK_BROWSING_DATA_QUOTA_HELPER_H_ -#pragma once - -#include <string> -#include <vector> - -#include "base/compiler_specific.h" -#include "base/memory/scoped_ptr.h" -#include "chrome/browser/browsing_data_quota_helper.h" - -class MockBrowsingDataQuotaHelper : public BrowsingDataQuotaHelper { - public: - explicit MockBrowsingDataQuotaHelper(Profile* profile); - - virtual void StartFetching(FetchResultCallback* callback) OVERRIDE; - virtual void CancelNotification() OVERRIDE; - - void AddHost(const std::string& host, - int64 temporary_usage, - int64 persistent_usage); - void AddQuotaSamples(); - void Notify(); - - private: - virtual ~MockBrowsingDataQuotaHelper(); - - scoped_ptr<FetchResultCallback> callback_; - std::vector<QuotaInfo> response_; - Profile* profile_; -}; - -#endif // CHROME_BROWSER_MOCK_BROWSING_DATA_QUOTA_HELPER_H_ diff --git a/chrome/browser/resources/options/cookies_list.js b/chrome/browser/resources/options/cookies_list.js index 1650c11..d4722cc 100644 --- a/chrome/browser/resources/options/cookies_list.js +++ b/chrome/browser/resources/options/cookies_list.js @@ -119,8 +119,6 @@ cr.define('options', function() { this.siteChild.className = 'cookie-site'; this.dataChild = this.ownerDocument.createElement('div'); this.dataChild.className = 'cookie-data'; - this.sizeChild = this.ownerDocument.createElement('div'); - this.sizeChild.className = 'cookie-size'; this.itemsChild = this.ownerDocument.createElement('div'); this.itemsChild.className = 'cookie-items'; this.infoChild = this.ownerDocument.createElement('div'); @@ -133,7 +131,6 @@ cr.define('options', function() { var content = this.contentElement; content.appendChild(this.siteChild); content.appendChild(this.dataChild); - content.appendChild(this.sizeChild); content.appendChild(this.itemsChild); this.itemsChild.appendChild(this.infoChild); if (this.origin && this.origin.data) { @@ -253,10 +250,6 @@ cr.define('options', function() { else text = list[i]; this.dataChild.textContent = text; - if (info.quota && info.quota.totalUsage) { - this.sizeChild.textContent = info.quota.totalUsage; - } - if (this.expanded) this.updateItems_(); }, @@ -437,21 +430,18 @@ cr.define('options', function() { for (var i = 0; i < this.children.length; ++i) this.children[i].collectSummaryInfo(info); } else if (this.data && !this.data.hasChildren) { - if (this.data.type == 'cookie') { + if (this.data.type == 'cookie') info.cookies++; - } else if (this.data.type == 'database') { + else if (this.data.type == 'database') info.database = true; - } else if (this.data.type == 'local_storage') { + else if (this.data.type == 'local_storage') info.localStorage = true; - } else if (this.data.type == 'app_cache') { + else if (this.data.type == 'app_cache') info.appCache = true; - } else if (this.data.type == 'indexed_db') { + else if (this.data.type == 'indexed_db') info.indexedDb = true; - } else if (this.data.type == 'file_system') { + else if (this.data.type == 'file_system') info.fileSystem = true; - } else if (this.data.type == 'quota') { - info.quota = this.data; - } } }, @@ -484,8 +474,6 @@ cr.define('options', function() { text = localStrings.getString('cookie_file_system'); break; } - if (!text) - return; var div = item.ownerDocument.createElement('div'); div.className = 'cookie-item'; // Help out screen readers and such: this is a clickable thing. diff --git a/chrome/browser/resources/options/cookies_view.css b/chrome/browser/resources/options/cookies_view.css index 2aab6b2..19c5b42 100644 --- a/chrome/browser/resources/options/cookies_view.css +++ b/chrome/browser/resources/options/cookies_view.css @@ -1,5 +1,5 @@ /* -Copyright (c) 2011 The Chromium Authors. All rights reserved. +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. */ @@ -88,12 +88,6 @@ list.cookie-list > .deletable-item[selected] .cookie-site { display: inline-block; } -.cookie-size { - display: inline-block; - float: right; - margin-right: 3em; -} - list.cookie-list > .deletable-item[selected] .cookie-data { -webkit-user-select: text; } diff --git a/chrome/browser/ui/webui/cookies_tree_model_util.cc b/chrome/browser/ui/webui/cookies_tree_model_util.cc index 05dc69c..ac744b49 100644 --- a/chrome/browser/ui/webui/cookies_tree_model_util.cc +++ b/chrome/browser/ui/webui/cookies_tree_model_util.cc @@ -41,13 +41,6 @@ static const char kKeyModified[] = "modified"; static const char kKeyPersistent[] = "persistent"; static const char kKeyTemporary[] = "temporary"; -static const char kKeyTotalUsage[] = "totalUsage"; -static const char kKeyTemporaryUsage[] = "temporaryUsage"; -static const char kKeyPersistentUsage[] = "persistentUsage"; -static const char kKeyPersistentQuota[] = "persistentQuota"; - -static const int64 kNegligibleUsage = 1024; // 1KiB - // Encodes a pointer value into a hex string. std::string PointerToHexString(const void* pointer) { return base::HexEncode(&pointer, sizeof(pointer)); @@ -72,7 +65,7 @@ std::string GetTreeNodeId(CookieTreeNode* node) { return PointerToHexString(node); } -bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, +void GetCookieTreeNodeDictionary(const CookieTreeNode& node, DictionaryValue* dict) { // Use node's address as an id for WebUI to look it up. dict->SetString(kKeyId, PointerToHexString(&node)); @@ -197,36 +190,12 @@ bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); break; } - case CookieTreeNode::DetailedInfo::TYPE_QUOTA: { - dict->SetString(kKeyType, "quota"); - dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); - - const BrowsingDataQuotaHelper::QuotaInfo& quota_info = - *node.GetDetailedInfo().quota_info; - if (quota_info.temporary_usage + quota_info.persistent_usage <= - kNegligibleUsage) - return false; - - dict->SetString(kKeyOrigin, quota_info.host); - dict->SetString(kKeyTotalUsage, - UTF16ToUTF8(ui::FormatBytes( - quota_info.temporary_usage + - quota_info.persistent_usage))); - dict->SetString(kKeyTemporaryUsage, - UTF16ToUTF8(ui::FormatBytes( - quota_info.temporary_usage))); - dict->SetString(kKeyPersistentUsage, - UTF16ToUTF8(ui::FormatBytes( - quota_info.persistent_usage))); - break; - } default: #if defined(OS_MACOSX) dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER"); #endif break; } - return true; } void GetChildNodeList(CookieTreeNode* parent, int start, int count, @@ -234,10 +203,8 @@ void GetChildNodeList(CookieTreeNode* parent, int start, int count, for (int i = 0; i < count; ++i) { DictionaryValue* dict = new DictionaryValue; CookieTreeNode* child = parent->GetChild(start + i); - if (GetCookieTreeNodeDictionary(*child, dict)) - nodes->Append(dict); - else - delete dict; + GetCookieTreeNodeDictionary(*child, dict); + nodes->Append(dict); } } diff --git a/chrome/browser/ui/webui/cookies_tree_model_util.h b/chrome/browser/ui/webui/cookies_tree_model_util.h index 2331292..2b27b65 100644 --- a/chrome/browser/ui/webui/cookies_tree_model_util.h +++ b/chrome/browser/ui/webui/cookies_tree_model_util.h @@ -21,8 +21,7 @@ namespace cookies_tree_model_util { std::string GetTreeNodeId(CookieTreeNode* node); // Populate given |dict| with cookie tree node properties. -// Returns false if the |node| does not need to be shown. -bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, +void GetCookieTreeNodeDictionary(const CookieTreeNode& node, base::DictionaryValue* dict); // Append the children nodes of |parent| in specified range to |nodes| list. diff --git a/chrome/browser/ui/webui/options/cookies_view_handler.cc b/chrome/browser/ui/webui/options/cookies_view_handler.cc index b046077..b2c1c7c 100644 --- a/chrome/browser/ui/webui/options/cookies_view_handler.cc +++ b/chrome/browser/ui/webui/options/cookies_view_handler.cc @@ -10,7 +10,6 @@ #include "chrome/browser/browsing_data_database_helper.h" #include "chrome/browser/browsing_data_file_system_helper.h" #include "chrome/browser/browsing_data_indexed_db_helper.h" -#include "chrome/browser/browsing_data_quota_helper.h" #include "chrome/browser/browsing_data_local_storage_helper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/cookies_tree_model_util.h" @@ -67,7 +66,7 @@ void CookiesViewHandler::GetLocalizedValues( { "label_file_system_temporary_usage", IDS_COOKIES_FILE_SYSTEM_TEMPORARY_USAGE_LABEL }, { "label_file_system_persistent_usage", - IDS_COOKIES_FILE_SYSTEM_PERSISTENT_USAGE_LABEL }, + IDS_COOKIES_FILE_SYSTEM_PERSISTENT_USAGE_LABEL } }; RegisterStrings(localized_strings, resources, arraysize(resources)); @@ -152,7 +151,6 @@ void CookiesViewHandler::EnsureCookiesTreeModelCreated() { new BrowsingDataAppCacheHelper(profile), BrowsingDataIndexedDBHelper::Create(profile), BrowsingDataFileSystemHelper::Create(profile), - BrowsingDataQuotaHelper::Create(profile), false)); cookies_tree_model_->AddCookiesTreeObserver(this); } diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 859ebd1..6f987b5 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -315,10 +315,6 @@ 'browser/browsing_data_indexed_db_helper.h', 'browser/browsing_data_local_storage_helper.cc', 'browser/browsing_data_local_storage_helper.h', - 'browser/browsing_data_quota_helper.cc', - 'browser/browsing_data_quota_helper.h', - 'browser/browsing_data_quota_helper_impl.cc', - 'browser/browsing_data_quota_helper_impl.h', 'browser/browsing_data_remover.cc', 'browser/browsing_data_remover.h', 'browser/bug_report_data.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 640a8ab..2a9f0f7 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -87,8 +87,6 @@ 'browser/mock_browsing_data_indexed_db_helper.h', 'browser/mock_browsing_data_local_storage_helper.cc', 'browser/mock_browsing_data_local_storage_helper.h', - 'browser/mock_browsing_data_quota_helper.cc', - 'browser/mock_browsing_data_quota_helper.h', 'browser/notifications/notification_test_util.cc', 'browser/notifications/notification_test_util.h', 'browser/policy/mock_cloud_policy_data_store.cc', @@ -1326,7 +1324,6 @@ 'browser/browsing_data_file_system_helper_unittest.cc', 'browser/browsing_data_indexed_db_helper_unittest.cc', 'browser/browsing_data_local_storage_helper_unittest.cc', - 'browser/browsing_data_quota_helper_unittest.cc', 'browser/browsing_data_remover_unittest.cc', 'browser/chrome_browser_application_mac_unittest.mm', 'browser/chromeos/cros/network_library.cc', @@ -2080,8 +2077,6 @@ '../webkit/fileapi/file_writer_delegate_unittest.cc', '../webkit/fileapi/file_system_test_helper.cc', '../webkit/fileapi/file_system_test_helper.h', - '../webkit/quota/mock_storage_client.cc', - '../webkit/quota/mock_storage_client.h', ], 'conditions': [ ['p2p_apis==1', { diff --git a/webkit/quota/mock_storage_client.cc b/webkit/quota/mock_storage_client.cc index 203c6cb5..897f100 100644 --- a/webkit/quota/mock_storage_client.cc +++ b/webkit/quota/mock_storage_client.cc @@ -84,15 +84,6 @@ void MockStorageClient::ModifyOriginAndNotify( id(), origin_url, type, delta, IncrementMockTime()); } -void MockStorageClient::TouchAllOriginsAndNotify() { - for (OriginDataMap::const_iterator itr = origin_data_.begin(); - itr != origin_data_.end(); - ++itr) { - quota_manager_proxy_->quota_manager()->NotifyStorageModifiedInternal( - id(), itr->first.first, itr->first.second, 0, IncrementMockTime()); - } -} - void MockStorageClient::AddOriginToErrorSet( const GURL& origin_url, StorageType type) { error_origins_.insert(make_pair(origin_url, type)); diff --git a/webkit/quota/mock_storage_client.h b/webkit/quota/mock_storage_client.h index fdc2677..bf381ad 100644 --- a/webkit/quota/mock_storage_client.h +++ b/webkit/quota/mock_storage_client.h @@ -37,7 +37,6 @@ class MockStorageClient : public QuotaClient { const GURL& origin_url, StorageType type, int64 size); void ModifyOriginAndNotify( const GURL& origin_url, StorageType type, int64 delta); - void TouchAllOriginsAndNotify(); void AddOriginToErrorSet(const GURL& origin_url, StorageType type); |