| Index: chrome/browser/cookies_tree_model.h
|
| diff --git a/chrome/browser/cookies_tree_model.h b/chrome/browser/cookies_tree_model.h
|
| index adda762acb1995ee4cdc2e823bf03953b3fcf043..4c352010494f9213553dd374e95bf0b72772cdee 100644
|
| --- a/chrome/browser/cookies_tree_model.h
|
| +++ b/chrome/browser/cookies_tree_model.h
|
| @@ -25,6 +25,7 @@
|
| #include "chrome/browser/browsing_data_local_storage_helper.h"
|
| #include "chrome/browser/browsing_data_quota_helper.h"
|
| #include "chrome/common/content_settings.h"
|
| +#include "chrome/common/extensions/extension_set.h"
|
| #include "net/base/server_bound_cert_store.h"
|
| #include "net/cookies/cookie_monster.h"
|
| #include "ui/base/models/tree_node_model.h"
|
| @@ -50,7 +51,8 @@ class CookieTreeSessionStorageNode;
|
| class CookieTreeSessionStoragesNode;
|
| class CookieTreeIndexedDBNode;
|
| class CookieTreeIndexedDBsNode;
|
| -class CookieTreeOriginNode;
|
| +class CookieTreeHostNode;
|
| +class ExtensionSpecialStoragePolicy;
|
|
|
| // CookieTreeNode -------------------------------------------------------------
|
| // The base node type in the Cookies, Databases, and Local Storage options
|
| @@ -66,7 +68,7 @@ class CookieTreeNode : public ui::TreeNode<CookieTreeNode> {
|
| enum NodeType {
|
| TYPE_NONE,
|
| TYPE_ROOT, // This is used for CookieTreeRootNode nodes.
|
| - TYPE_ORIGIN, // This is used for CookieTreeOriginNode nodes.
|
| + TYPE_HOST, // This is used for CookieTreeHostNode nodes.
|
| TYPE_COOKIES, // This is used for CookieTreeCookiesNode nodes.
|
| TYPE_COOKIE, // This is used for CookieTreeCookieNode nodes.
|
| TYPE_DATABASES, // This is used for CookieTreeDatabasesNode.
|
| @@ -86,93 +88,33 @@ class CookieTreeNode : public ui::TreeNode<CookieTreeNode> {
|
| TYPE_SERVER_BOUND_CERT, // Used for CookieTreeServerBoundCertNode.
|
| };
|
|
|
| - // TODO(viettrungluu): Figure out whether we want to store |origin| as a
|
| - // |string16| or a (UTF-8) |std::string|, and convert.
|
| - explicit DetailedInfo(const string16& origin)
|
| - : origin(origin),
|
| - node_type(TYPE_NONE),
|
| - cookie(NULL),
|
| - database_info(NULL),
|
| - local_storage_info(NULL),
|
| - session_storage_info(NULL),
|
| - appcache_info(NULL),
|
| - indexed_db_info(NULL),
|
| - file_system_info(NULL),
|
| - quota_info(NULL),
|
| - server_bound_cert(NULL) {}
|
| -
|
| - DetailedInfo& Init(NodeType type) {
|
| - DCHECK_EQ(TYPE_NONE, node_type);
|
| - node_type = type;
|
| - return *this;
|
| - }
|
| + DetailedInfo();
|
| + ~DetailedInfo();
|
|
|
| + DetailedInfo& Init(NodeType type);
|
| DetailedInfo& InitCookie(
|
| - const net::CookieMonster::CanonicalCookie* cookie) {
|
| - Init(TYPE_COOKIE);
|
| - this->cookie = cookie;
|
| - return *this;
|
| - }
|
| -
|
| + const net::CookieMonster::CanonicalCookie* cookie);
|
| DetailedInfo& InitDatabase(
|
| - const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) {
|
| - Init(TYPE_DATABASE);
|
| - this->database_info = database_info;
|
| - return *this;
|
| - }
|
| -
|
| + const BrowsingDataDatabaseHelper::DatabaseInfo* database_info);
|
| DetailedInfo& InitLocalStorage(
|
| const BrowsingDataLocalStorageHelper::LocalStorageInfo*
|
| - local_storage_info) {
|
| - Init(TYPE_LOCAL_STORAGE);
|
| - this->local_storage_info = local_storage_info;
|
| - return *this;
|
| - }
|
| -
|
| + local_storage_info);
|
| DetailedInfo& InitSessionStorage(
|
| const BrowsingDataLocalStorageHelper::LocalStorageInfo*
|
| - session_storage_info) {
|
| - Init(TYPE_SESSION_STORAGE);
|
| - this->session_storage_info = session_storage_info;
|
| - return *this;
|
| - }
|
| -
|
| - DetailedInfo& InitAppCache(const appcache::AppCacheInfo* appcache_info) {
|
| - Init(TYPE_APPCACHE);
|
| - this->appcache_info = appcache_info;
|
| - return *this;
|
| - }
|
| -
|
| + session_storage_info);
|
| + DetailedInfo& InitAppCache(const GURL& origin,
|
| + const appcache::AppCacheInfo* appcache_info);
|
| DetailedInfo& InitIndexedDB(
|
| - const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info) {
|
| - Init(TYPE_INDEXED_DB);
|
| - this->indexed_db_info = indexed_db_info;
|
| - return *this;
|
| - }
|
| -
|
| + const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info);
|
| DetailedInfo& InitFileSystem(
|
| - const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info) {
|
| - Init(TYPE_FILE_SYSTEM);
|
| - this->file_system_info = file_system_info;
|
| - return *this;
|
| - }
|
| -
|
| + const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info);
|
| DetailedInfo& InitQuota(
|
| - const BrowsingDataQuotaHelper::QuotaInfo* quota_info) {
|
| - Init(TYPE_QUOTA);
|
| - this->quota_info = quota_info;
|
| - return *this;
|
| - }
|
| -
|
| + const BrowsingDataQuotaHelper::QuotaInfo* quota_info);
|
| DetailedInfo& InitServerBoundCert(
|
| - const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert) {
|
| - Init(TYPE_SERVER_BOUND_CERT);
|
| - this->server_bound_cert = server_bound_cert;
|
| - return *this;
|
| - }
|
| + const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert);
|
|
|
| - string16 origin;
|
| NodeType node_type;
|
| + GURL origin;
|
| const net::CookieMonster::CanonicalCookie* cookie;
|
| const BrowsingDataDatabaseHelper::DatabaseInfo* database_info;
|
| const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info;
|
| @@ -205,7 +147,6 @@ class CookieTreeNode : public ui::TreeNode<CookieTreeNode> {
|
| void AddChildSortedByTitle(CookieTreeNode* new_child);
|
|
|
| private:
|
| -
|
| DISALLOW_COPY_AND_ASSIGN(CookieTreeNode);
|
| };
|
|
|
| @@ -216,7 +157,7 @@ class CookieTreeRootNode : public CookieTreeNode {
|
| explicit CookieTreeRootNode(CookiesTreeModel* model);
|
| virtual ~CookieTreeRootNode();
|
|
|
| - CookieTreeOriginNode* GetOrCreateOriginNode(const GURL& url);
|
| + CookieTreeHostNode* GetOrCreateHostNode(const GURL& url);
|
|
|
| // CookieTreeNode methods:
|
| virtual CookiesTreeModel* GetModel() const OVERRIDE;
|
| @@ -228,19 +169,19 @@ class CookieTreeRootNode : public CookieTreeNode {
|
| DISALLOW_COPY_AND_ASSIGN(CookieTreeRootNode);
|
| };
|
|
|
| -// CookieTreeOriginNode -------------------------------------------------------
|
| -class CookieTreeOriginNode : public CookieTreeNode {
|
| +// CookieTreeHostNode -------------------------------------------------------
|
| +class CookieTreeHostNode : public CookieTreeNode {
|
| public:
|
| - // Returns the origin node's title to use for a given URL.
|
| - static std::wstring TitleForUrl(const GURL& url);
|
| + // Returns the host node's title to use for a given URL.
|
| + static string16 TitleForUrl(const GURL& url);
|
|
|
| - explicit CookieTreeOriginNode(const GURL& url);
|
| - virtual ~CookieTreeOriginNode();
|
| + explicit CookieTreeHostNode(const GURL& url);
|
| + virtual ~CookieTreeHostNode();
|
|
|
| // CookieTreeNode methods:
|
| virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
|
|
|
| - // CookieTreeOriginNode methods:
|
| + // CookieTreeHostNode methods:
|
| CookieTreeCookiesNode* GetOrCreateCookiesNode();
|
| CookieTreeDatabasesNode* GetOrCreateDatabasesNode();
|
| CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode();
|
| @@ -279,7 +220,7 @@ class CookieTreeOriginNode : public CookieTreeNode {
|
| // The URL for which this node was initially created.
|
| GURL url_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(CookieTreeOriginNode);
|
| + DISALLOW_COPY_AND_ASSIGN(CookieTreeHostNode);
|
| };
|
|
|
| // CookieTreeCookieNode ------------------------------------------------------
|
| @@ -633,6 +574,7 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> {
|
| BrowsingDataFileSystemHelper* file_system_helper,
|
| BrowsingDataQuotaHelper* quota_helper,
|
| BrowsingDataServerBoundCertHelper* server_bound_cert_helper,
|
| + ExtensionSpecialStoragePolicy* special_storage_policy,
|
| bool use_cookie_source);
|
| virtual ~CookiesTreeModel();
|
|
|
| @@ -651,7 +593,14 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> {
|
| void DeleteCookieNode(CookieTreeNode* cookie_node);
|
|
|
| // Filter the origins to only display matched results.
|
| - void UpdateSearchResults(const std::wstring& filter);
|
| + void UpdateSearchResults(const string16& filter);
|
| +
|
| + // Returns the set of extensions which protect the data item represented by
|
| + // this node from deletion.
|
| + // Returns NULL if the node doesn't represent a protected data item or the
|
| + // special storage policy is NULL.
|
| + const ExtensionSet* ExtensionsProtectingNode(
|
| + const CookieTreeNode& cookie_node);
|
|
|
| // Manages CookiesTreeModel::Observers. This will also call
|
| // TreeNodeModel::AddObserver so that it gets all the proper notifications.
|
| @@ -694,15 +643,15 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> {
|
| void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info);
|
| void OnServerBoundCertModelInfoLoaded(const ServerBoundCertList& cert_list);
|
|
|
| - void PopulateAppCacheInfoWithFilter(const std::wstring& filter);
|
| - void PopulateCookieInfoWithFilter(const std::wstring& filter);
|
| - void PopulateDatabaseInfoWithFilter(const std::wstring& filter);
|
| - void PopulateLocalStorageInfoWithFilter(const std::wstring& filter);
|
| - 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 PopulateServerBoundCertInfoWithFilter(const std::wstring& filter);
|
| + void PopulateAppCacheInfoWithFilter(const string16& filter);
|
| + void PopulateCookieInfoWithFilter(const string16& filter);
|
| + void PopulateDatabaseInfoWithFilter(const string16& filter);
|
| + void PopulateLocalStorageInfoWithFilter(const string16& filter);
|
| + void PopulateSessionStorageInfoWithFilter(const string16& filter);
|
| + void PopulateIndexedDBInfoWithFilter(const string16& filter);
|
| + void PopulateFileSystemInfoWithFilter(const string16& filter);
|
| + void PopulateQuotaInfoWithFilter(const string16& filter);
|
| + void PopulateServerBoundCertInfoWithFilter(const string16& filter);
|
|
|
| void NotifyObserverBeginBatch();
|
| void NotifyObserverEndBatch();
|
| @@ -726,6 +675,7 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> {
|
| FileSystemInfoList file_system_info_list_;
|
| QuotaInfoArray quota_info_list_;
|
| ServerBoundCertList server_bound_cert_list_;
|
| + scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_;
|
|
|
| // The CookiesTreeModel maintains a separate list of observers that are
|
| // specifically of the type CookiesTreeModel::Observer.
|
|
|