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

Unified Diff: chrome/browser/cookies_tree_model.cc

Issue 435024: Adds back the ability to filter cookies by origin in the cookies options view... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « chrome/browser/cookies_tree_model.h ('k') | chrome/browser/views/options/cookies_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cookies_tree_model.cc
===================================================================
--- chrome/browser/cookies_tree_model.cc (revision 32829)
+++ chrome/browser/cookies_tree_model.cc (working copy)
@@ -224,6 +224,10 @@
}
void CookiesTreeModel::LoadCookies() {
+ LoadCookiesWithFilter(L"");
+}
+
+void CookiesTreeModel::LoadCookiesWithFilter(const std::wstring& filter) {
// mmargh mmargh mmargh!
// Since we are running on the UI thread don't call GetURLRequestContext().
@@ -236,11 +240,14 @@
it != all_cookies_.end();
++it) {
// Get the origin cookie
- CookieTreeOriginNode* origin =
- root->GetOrCreateOriginNode(UTF8ToWide(it->first));
- CookieTreeCookiesNode* cookies_node = origin->GetOrCreateCookiesNode();
- CookieTreeCookieNode* new_cookie = new CookieTreeCookieNode(&*it);
- cookies_node->AddCookieNode(new_cookie);
+ if (!filter.size() ||
+ (UTF8ToWide(it->first).find(filter) != std::wstring::npos)) {
+ CookieTreeOriginNode* origin =
+ root->GetOrCreateOriginNode(UTF8ToWide(it->first));
+ CookieTreeCookiesNode* cookies_node = origin->GetOrCreateCookiesNode();
+ CookieTreeCookieNode* new_cookie = new CookieTreeCookieNode(&*it);
+ cookies_node->AddCookieNode(new_cookie);
+ }
}
}
@@ -263,9 +270,8 @@
CookieTreeNode* root = GetRoot();
root->DeleteStoredObjects();
int num_children = root->GetChildCount();
- for (int i = num_children - 1; i >= 0; --i) {
+ for (int i = num_children - 1; i >= 0; --i)
delete Remove(root, i);
- }
LoadCookies();
NotifyObserverTreeNodeChanged(root);
}
@@ -277,3 +283,12 @@
int cookie_node_index = parent_node->IndexOfChild(cookie_node);
delete Remove(parent_node, cookie_node_index);
}
+
+void CookiesTreeModel::UpdateSearchResults(const std::wstring& filter) {
+ CookieTreeNode* root = GetRoot();
+ int num_children = root->GetChildCount();
+ for (int i = num_children - 1; i >= 0; --i)
+ delete Remove(root, i);
+ LoadCookiesWithFilter(filter);
+ NotifyObserverTreeNodeChanged(root);
+}
« no previous file with comments | « chrome/browser/cookies_tree_model.h ('k') | chrome/browser/views/options/cookies_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698