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

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: Refactoring common code and style fixes. 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..b3c4216c47c0551f8744e21b3eefce3e85eb5fa3 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,12 @@ 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(
+ string16 name = ASCIIToUTF16("Site Data");
+ string16 browser_id;
Evan Stade 2012/06/20 21:06:30 this is still here
nasko 2012/06/20 22:32:32 Done.
+ ContainerMap apps_map;
+
+ apps_map[browser_id] = new LocalDataContainer(
+ name, browser_id,
new BrowsingDataCookieHelper(profile->GetRequestContext()),
new BrowsingDataDatabaseHelper(profile),
new BrowsingDataLocalStorageHelper(profile),
@@ -171,26 +179,55 @@ 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) {
+ string16 app_id;
Evan Stade 2012/06/20 21:06:30 why is this declared here
nasko 2012/06/20 22:32:32 The reason is that in the loop over all extensions
+ 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());
+ name = ASCIIToUTF16((*it)->name());
+ app_id = ASCIIToUTF16((*it)->id());
+ apps_map[app_id] = new LocalDataContainer(
+ name, app_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(string16());
}
void CookiesViewHandler::Remove(const ListValue* args) {

Powered by Google App Engine
This is Rietveld 408576698