Index: chrome/browser/cookies_tree_model.cc |
diff --git a/chrome/browser/cookies_tree_model.cc b/chrome/browser/cookies_tree_model.cc |
index e3687e4f90ab7ba7e9255ca508aac50aab1097f4..eec89eeae266ebd56380f35b41fcdf8c79ebcd4e 100644 |
--- a/chrome/browser/cookies_tree_model.cc |
+++ b/chrome/browser/cookies_tree_model.cc |
@@ -13,6 +13,7 @@ |
#include "base/string_util.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
+#include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" |
#include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" |
#include "chrome/browser/content_settings/cookie_settings.h" |
#include "chrome/browser/extensions/extension_service.h" |
@@ -253,6 +254,13 @@ CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitServerBoundCert( |
return *this; |
} |
+CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitFlashLSO( |
+ const std::string& flash_lso_domain) { |
+ Init(TYPE_FLASH_LSO); |
+ this->flash_lso_domain = flash_lso_domain; |
+ return *this; |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
// CookieTreeNode, public: |
@@ -580,6 +588,7 @@ CookieTreeHostNode::CookieTreeHostNode(const GURL& url, |
file_systems_child_(NULL), |
quota_child_(NULL), |
server_bound_certs_child_(NULL), |
+ flash_lso_child_(NULL), |
app_id_(app_id), |
app_name_(name), |
url_(url), |
@@ -673,6 +682,16 @@ CookieTreeHostNode::GetOrCreateServerBoundCertsNode() { |
return server_bound_certs_child_; |
} |
+CookieTreeFlashLSONode* CookieTreeHostNode::GetOrCreateFlashLSONode( |
+ const std::string& domain) { |
+ DCHECK_EQ(GetHost(), domain); |
+ if (flash_lso_child_) |
+ return flash_lso_child_; |
+ flash_lso_child_ = new CookieTreeFlashLSONode(domain); |
+ AddChildSortedByTitle(flash_lso_child_); |
+ return flash_lso_child_; |
+} |
+ |
void CookieTreeHostNode::CreateContentException( |
CookieSettings* cookie_settings, ContentSetting setting) const { |
DCHECK(setting == CONTENT_SETTING_ALLOW || |
@@ -813,6 +832,29 @@ void CookieTreeNode::AddChildSortedByTitle(CookieTreeNode* new_child) { |
} |
/////////////////////////////////////////////////////////////////////////////// |
+// CookieTreeFlashLSONode |
+CookieTreeFlashLSONode::CookieTreeFlashLSONode( |
+ const std::string& domain) |
+ : domain_(domain) {} |
+CookieTreeFlashLSONode::~CookieTreeFlashLSONode() {} |
+ |
+void CookieTreeFlashLSONode::DeleteStoredObjects() { |
+ // We are one level below the host node. |
+ CookieTreeHostNode* host = static_cast<CookieTreeHostNode*>(parent()); |
+ CHECK_EQ(host->GetDetailedInfo().node_type, |
+ CookieTreeNode::DetailedInfo::TYPE_HOST); |
+ LocalDataContainer* container = |
+ GetModel()->GetLocalDataContainer(host->app_id()); |
+ CHECK(container); |
+ |
+ container->flash_lso_helper_->DeleteFlashLSOsForSite(domain_); |
+} |
+ |
+CookieTreeNode::DetailedInfo CookieTreeFlashLSONode::GetDetailedInfo() const { |
+ return DetailedInfo().InitFlashLSO(domain_); |
+} |
+ |
+/////////////////////////////////////////////////////////////////////////////// |
// ScopedBatchUpdateNotifier |
CookiesTreeModel::ScopedBatchUpdateNotifier::ScopedBatchUpdateNotifier( |
CookiesTreeModel* model, CookieTreeNode* node) |
@@ -1020,6 +1062,12 @@ void CookiesTreeModel::PopulateServerBoundCertInfo( |
PopulateServerBoundCertInfoWithFilter(container, ¬ifier, string16()); |
} |
+void CookiesTreeModel::PopulateFlashLSOInfo( |
+ LocalDataContainer* container) { |
+ ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
+ PopulateFlashLSOInfoWithFilter(container, ¬ifier, string16()); |
+} |
+ |
void CookiesTreeModel::PopulateAppCacheInfoWithFilter( |
LocalDataContainer* container, |
ScopedBatchUpdateNotifier* notifier, |
@@ -1299,6 +1347,31 @@ void CookiesTreeModel::PopulateQuotaInfoWithFilter( |
} |
} |
+void CookiesTreeModel::PopulateFlashLSOInfoWithFilter( |
+ LocalDataContainer* container, |
+ ScopedBatchUpdateNotifier* notifier, |
+ const string16& filter) { |
+ CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
+ |
+ if (container->flash_lso_domain_list_.empty()) |
+ return; |
+ |
+ std::string filter_utf8 = UTF16ToUTF8(filter); |
+ notifier->StartBatchUpdate(); |
+ for (std::vector<std::string>::iterator it = |
+ container->flash_lso_domain_list_.begin(); |
+ it != container->flash_lso_domain_list_.end(); ++it) { |
+ if (!filter_utf8.size() || it->find(filter_utf8) != std::string::npos) { |
+ // Create a fake origin for GetOrCreateHostNode(). |
+ GURL origin("http://" + *it); |
+ CookieTreeHostNode* host_node = |
+ root->GetOrCreateHostNode(origin, container->app_id(), |
+ container->app_name()); |
+ host_node->GetOrCreateFlashLSONode(*it); |
+ } |
+ } |
+} |
+ |
void CookiesTreeModel::NotifyObserverBeginBatch() { |
// Only notify the model once if we're batching in a nested manner. |
if (batch_update_++ == 0) { |