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

Unified Diff: chrome/browser/ui/webui/options2/cookies_view_handler2.cc

Issue 10536017: Refactoring CookiesTreeModel to support multiple data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed all comments by Evan. Created 8 years, 6 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/ui/webui/options2/cookies_view_handler2.cc
diff --git a/chrome/browser/ui/webui/options2/cookies_view_handler2.cc b/chrome/browser/ui/webui/options2/cookies_view_handler2.cc
index e37cbd3f9d9a02fc490533238e7e43f96a48c4ab..2229ed4dd392dc6aadfedf6ecb1c178bdcce8e0e 100644
--- a/chrome/browser/ui/webui/options2/cookies_view_handler2.cc
+++ b/chrome/browser/ui/webui/options2/cookies_view_handler2.cc
@@ -8,6 +8,8 @@
#include "base/bind_helpers.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_set.h"
#include "chrome/browser/browsing_data_appcache_helper.h"
#include "chrome/browser/browsing_data_cookie_helper.h"
#include "chrome/browser/browsing_data_database_helper.h"
@@ -16,6 +18,7 @@
#include "chrome/browser/browsing_data_local_storage_helper.h"
#include "chrome/browser/browsing_data_quota_helper.h"
#include "chrome/browser/browsing_data_server_bound_cert_helper.h"
+#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/cookies_tree_model_util.h"
#include "content/public/browser/web_ui.h"
@@ -162,7 +165,10 @@ void CookiesViewHandler::TreeModelEndBatch(CookiesTreeModel* model) {
void CookiesViewHandler::EnsureCookiesTreeModelCreated() {
if (!cookies_tree_model_.get()) {
Profile* profile = Profile::FromWebUI(web_ui());
- cookies_tree_model_.reset(new CookiesTreeModel(
+ ContainerMap apps_map;
+
+ apps_map[""] = new LocalDataContainer(
James Hawkins 2012/06/21 00:04:12 s/""/string16/ (or std::string() where appropriate
nasko 2012/06/21 16:22:12 Done.
+ "Site Data", "",
new BrowsingDataCookieHelper(profile->GetRequestContext()),
new BrowsingDataDatabaseHelper(profile),
new BrowsingDataLocalStorageHelper(profile),
@@ -171,26 +177,52 @@ void CookiesViewHandler::EnsureCookiesTreeModelCreated() {
BrowsingDataIndexedDBHelper::Create(profile),
BrowsingDataFileSystemHelper::Create(profile),
BrowsingDataQuotaHelper::Create(profile),
- BrowsingDataServerBoundCertHelper::Create(profile),
- false));
+ BrowsingDataServerBoundCertHelper::Create(profile));
+
+ const ExtensionService* service = profile->GetExtensionService();
+ if (service) {
+ const ExtensionSet* extensions = service->extensions();
+ for (ExtensionSet::const_iterator it = extensions->begin();
+ it != extensions->end(); ++it) {
+ if ((*it)->is_storage_isolated()) {
+ net::URLRequestContextGetter* context_getter =
+ profile->GetRequestContextForIsolatedApp((*it)->id());
+ apps_map[(*it)->id()] = new LocalDataContainer(
+ (*it)->name(), (*it)->id(),
+ new BrowsingDataCookieHelper(context_getter),
+ new BrowsingDataDatabaseHelper(profile),
+ new BrowsingDataLocalStorageHelper(profile),
+ NULL,
+ new BrowsingDataAppCacheHelper(profile),
+ BrowsingDataIndexedDBHelper::Create(profile),
+ BrowsingDataFileSystemHelper::Create(profile),
+ BrowsingDataQuotaHelper::Create(profile),
+ BrowsingDataServerBoundCertHelper::Create(profile));
+ }
+ }
+ }
+ cookies_tree_model_.reset(new CookiesTreeModel(apps_map, false));
cookies_tree_model_->AddCookiesTreeObserver(this);
}
}
void CookiesViewHandler::UpdateSearchResults(const ListValue* args) {
- std::string query;
+ string16 query;
if (!args->GetString(0, &query)) {
return;
}
EnsureCookiesTreeModelCreated();
- cookies_tree_model_->UpdateSearchResults(UTF8ToWide(query));
+ cookies_tree_model_->UpdateSearchResults(query);
}
void CookiesViewHandler::RemoveAll(const ListValue* args) {
EnsureCookiesTreeModelCreated();
- cookies_tree_model_->DeleteAllStoredObjects();
+ // TODO(nasko): This will only remove the browser stored data, not the
+ // isolated apps data. This is fine for now, but should be changed based
+ // on the new isolated storage UI.
+ cookies_tree_model_->DeleteStoredObjectsForApp("");
Evan Stade 2012/06/21 04:01:41 nit: pass std::string()
nasko 2012/06/21 16:22:12 Done.
}
void CookiesViewHandler::Remove(const ListValue* args) {

Powered by Google App Engine
This is Rietveld 408576698