Chromium Code Reviews| 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..e180596f82e6cb805afec8e05ea9db35374d05d9 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" |
| @@ -113,6 +116,8 @@ void CookiesViewHandler::TreeNodesAdded(ui::TreeModel* model, |
| if (batch_update_) |
| return; |
| + LOG(ERROR) << "TreeNodesAdded: " << start << "|" << count; |
|
markusheintz_
2012/06/18 16:52:41
Please remove this line.
nasko
2012/06/18 19:59:14
Done.
|
| + |
| CookieTreeNode* parent_node = cookies_tree_model_->AsNode(parent); |
| ListValue* children = new ListValue; |
| @@ -126,6 +131,11 @@ void CookiesViewHandler::TreeNodesAdded(ui::TreeModel* model, |
| cookies_tree_model_util::GetTreeNodeId(parent_node))); |
| args.Append(Value::CreateIntegerValue(start)); |
| args.Append(children); |
| + |
| + LOG(ERROR) << "TreeNodesAdded: " << |
|
markusheintz_
2012/06/18 16:52:41
Please remove these lines
nasko
2012/06/18 19:59:14
Done.
|
| + cookies_tree_model_util::GetTreeNodeId(parent_node) << " -> " << |
| + parent_node->child_count(); |
| + |
| web_ui()->CallJavascriptFunction("CookiesView.onTreeItemAdded", args); |
| } |
| @@ -137,6 +147,8 @@ void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model, |
| if (batch_update_) |
| return; |
| + LOG(ERROR) << "TreeNodesRemoved: " << start << "|" << count; |
|
markusheintz_
2012/06/18 16:52:41
Please rm
nasko
2012/06/18 19:59:14
Done.
|
| + |
| ListValue args; |
| args.Append(parent == cookies_tree_model_->GetRoot() ? |
| Value::CreateNullValue() : |
| @@ -150,19 +162,28 @@ void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model, |
| void CookiesViewHandler::TreeModelBeginBatch(CookiesTreeModel* model) { |
| DCHECK(!batch_update_); // There should be no nested batch begin. |
| batch_update_ = true; |
| + LOG(ERROR) << "TreeModelBeginBatch"; |
|
markusheintz_
2012/06/18 16:52:41
Please rm.
nasko
2012/06/18 19:59:14
Done.
|
| } |
| void CookiesViewHandler::TreeModelEndBatch(CookiesTreeModel* model) { |
| DCHECK(batch_update_); |
| batch_update_ = false; |
| + LOG(ERROR) << "TreeModelEndBatch"; |
|
markusheintz_
2012/06/18 16:52:41
Please rm.
nasko
2012/06/18 19:59:14
Done.
|
| SendChildren(cookies_tree_model_->GetRoot()); |
| } |
| void CookiesViewHandler::EnsureCookiesTreeModelCreated() { |
| if (!cookies_tree_model_.get()) { |
| Profile* profile = Profile::FromWebUI(web_ui()); |
| - cookies_tree_model_.reset(new CookiesTreeModel( |
| + string16 name = ASCIIToUTF16("Browser-wide"); |
|
markusheintz_
2012/06/18 16:52:41
You use "Site-Data" as name in other places. Pleas
nasko
2012/06/18 19:59:14
In the other cases, it is UI only for a single sit
markusheintz_
2012/06/19 20:01:34
I think it is fine to use "Site-data", since we al
|
| + string16 browser_id; |
| + |
| + ContainerMap apps_map; |
| + LocalDataContainer* container; |
| + |
| + container = new LocalDataContainer( |
|
markusheintz_
2012/06/18 16:52:41
nit: I think you can just say:
apps_map[browser_id
nasko
2012/06/18 19:59:14
Done.
|
| + name, browser_id, |
| new BrowsingDataCookieHelper(profile->GetRequestContext()), |
| new BrowsingDataDatabaseHelper(profile), |
| new BrowsingDataLocalStorageHelper(profile), |
| @@ -171,26 +192,60 @@ void CookiesViewHandler::EnsureCookiesTreeModelCreated() { |
| BrowsingDataIndexedDBHelper::Create(profile), |
| BrowsingDataFileSystemHelper::Create(profile), |
| BrowsingDataQuotaHelper::Create(profile), |
| - BrowsingDataServerBoundCertHelper::Create(profile), |
| - false)); |
| + BrowsingDataServerBoundCertHelper::Create(profile)); |
| + apps_map[browser_id] = container; |
| + |
| + const ExtensionService* service = profile->GetExtensionService(); |
| + if (service) { |
| + string16 id; |
|
markusheintz_
2012/06/18 16:52:41
nit: I think you call this app_id every where else
nasko
2012/06/18 19:59:14
Done.
|
| + const ExtensionSet* extensions = service->extensions(); |
| + for (ExtensionSet::const_iterator it = extensions->begin(); |
| + it != extensions->end(); ++it) { |
|
markusheintz_
2012/06/18 16:52:41
Indent one space.
nasko
2012/06/18 19:59:14
Done.
|
| + if ((*it)->is_storage_isolated()) { |
| + net::URLRequestContextGetter* context_getter = |
| + profile->GetRequestContextForIsolatedApp((*it)->id()); |
| + name = ASCIIToUTF16((*it)->name()); |
| + id = ASCIIToUTF16((*it)->id()); |
| + container = new LocalDataContainer( |
|
markusheintz_
2012/06/18 16:52:41
nit: Same as above:
I think you can just say:
app
nasko
2012/06/18 19:59:14
Done.
|
| + name, 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)); |
| + apps_map[id] = container; |
| + } |
| + } |
| + } |
| + 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)); |
| + LOG(ERROR) << "UpdateSearchResults"; |
|
markusheintz_
2012/06/18 16:52:41
Please rm.
nasko
2012/06/18 19:59:14
Done.
|
| + |
| + cookies_tree_model_->UpdateSearchResults(query); |
| } |
| void CookiesViewHandler::RemoveAll(const ListValue* args) { |
| EnsureCookiesTreeModelCreated(); |
| - cookies_tree_model_->DeleteAllStoredObjects(); |
| + LOG(ERROR) << "RemoveAll"; |
|
markusheintz_
2012/06/18 16:52:41
Please rm.
nasko
2012/06/18 19:59:14
Done.
|
| + // 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) { |
| @@ -203,6 +258,7 @@ void CookiesViewHandler::Remove(const ListValue* args) { |
| CookieTreeNode* node = cookies_tree_model_util::GetTreeNodeFromPath( |
| cookies_tree_model_->GetRoot(), node_path); |
| + LOG(ERROR) << "RemoveChildren: " << node_path << "|" << node; |
|
markusheintz_
2012/06/18 16:52:41
Please rm.
nasko
2012/06/18 19:59:14
Done.
|
| if (node) |
| cookies_tree_model_->DeleteCookieNode(node); |
| } |
| @@ -217,6 +273,9 @@ void CookiesViewHandler::LoadChildren(const ListValue* args) { |
| CookieTreeNode* node = cookies_tree_model_util::GetTreeNodeFromPath( |
| cookies_tree_model_->GetRoot(), node_path); |
| + |
| + LOG(ERROR) << "LoadChildren: " << node_path << "|" << node; |
|
markusheintz_
2012/06/18 16:52:41
Please rm.
nasko
2012/06/18 19:59:14
Done.
|
| + |
| if (node) |
| SendChildren(node); |
| } |
| @@ -226,6 +285,10 @@ void CookiesViewHandler::SendChildren(CookieTreeNode* parent) { |
| cookies_tree_model_util::GetChildNodeList(parent, 0, parent->child_count(), |
| children); |
| + LOG(ERROR) << "SendChildren: " << |
|
markusheintz_
2012/06/18 16:52:41
Please rm.
nasko
2012/06/18 19:59:14
Done.
|
| + cookies_tree_model_util::GetTreeNodeId(parent) << " -> " << |
| + parent->child_count(); |
| + |
| ListValue args; |
| args.Append(parent == cookies_tree_model_->GetRoot() ? |
| Value::CreateNullValue() : |