Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Unified Diff: chrome/browser/cookies_tree_model.cc

Issue 10790150: Show Flash LSOs for Pepper Flash in cookie dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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, &notifier, string16());
}
+void CookiesTreeModel::PopulateFlashLSOInfo(
+ LocalDataContainer* container) {
+ ScopedBatchUpdateNotifier notifier(this, GetRoot());
+ PopulateFlashLSOInfoWithFilter(container, &notifier, 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) {

Powered by Google App Engine
This is Rietveld 408576698