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

Side by Side Diff: chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc

Issue 2391253002: Site Settings Desktop: Polish the Site Data section. (Closed)
Patch Set: Address feedback Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/settings/settings_cookies_view_handler.h" 5 #include "chrome/browser/ui/webui/settings/settings_cookies_view_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Skip if there is a batch update in progress. 81 // Skip if there is a batch update in progress.
82 if (batch_update_) 82 if (batch_update_)
83 return; 83 return;
84 84
85 AllowJavascript(); 85 AllowJavascript();
86 86
87 CookiesTreeModel* tree_model = static_cast<CookiesTreeModel*>(model); 87 CookiesTreeModel* tree_model = static_cast<CookiesTreeModel*>(model);
88 CookieTreeNode* parent_node = tree_model->AsNode(parent); 88 CookieTreeNode* parent_node = tree_model->AsNode(parent);
89 89
90 std::unique_ptr<base::ListValue> children(new base::ListValue); 90 std::unique_ptr<base::ListValue> children(new base::ListValue);
91 model_util_->GetChildNodeList(parent_node, start, count, children.get()); 91 // Passing false for |include_quota_nodes| since they don't reflect reality
92 // until bug http://crbug.com/642955 is fixed and local/session storage is
93 // counted against the total.
94 model_util_->GetChildNodeList(
95 parent_node, start, count, /*include_quota_nodes=*/false, children.get());
92 96
93 base::DictionaryValue args; 97 base::DictionaryValue args;
94 if (parent == tree_model->GetRoot()) 98 if (parent == tree_model->GetRoot())
95 args.Set(kId, base::Value::CreateNullValue()); 99 args.Set(kId, base::Value::CreateNullValue());
96 else 100 else
97 args.SetString(kId, model_util_->GetTreeNodeId(parent_node)); 101 args.SetString(kId, model_util_->GetTreeNodeId(parent_node));
98 args.SetInteger(kStart, start); 102 args.SetInteger(kStart, start);
99 args.Set(kChildren, std::move(children)); 103 args.Set(kChildren, std::move(children));
100 CallJavascriptFunction("cr.webUIListenerCallback", 104 CallJavascriptFunction("cr.webUIListenerCallback",
101 base::StringValue("onTreeItemAdded"), 105 base::StringValue("onTreeItemAdded"),
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( 218 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath(
215 cookies_tree_model_->GetRoot(), node_path); 219 cookies_tree_model_->GetRoot(), node_path);
216 if (node) 220 if (node)
217 SendChildren(node); 221 SendChildren(node);
218 } 222 }
219 223
220 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { 224 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) {
221 AllowJavascript(); 225 AllowJavascript();
222 226
223 std::unique_ptr<base::ListValue> children(new base::ListValue); 227 std::unique_ptr<base::ListValue> children(new base::ListValue);
224 model_util_->GetChildNodeList(parent, 0, parent->child_count(), 228 // Passing false for |include_quota_nodes| since they don't reflect reality
225 children.get()); 229 // until bug http://crbug.com/642955 is fixed and local/session storage is
230 // counted against the total.
231 model_util_->GetChildNodeList(parent, /*start=*/0, parent->child_count(),
232 /*include_quota_nodes=*/false, children.get());
226 233
227 base::DictionaryValue args; 234 base::DictionaryValue args;
228 if (parent == cookies_tree_model_->GetRoot()) 235 if (parent == cookies_tree_model_->GetRoot())
229 args.Set(kId, base::Value::CreateNullValue()); 236 args.Set(kId, base::Value::CreateNullValue());
230 else 237 else
231 args.SetString(kId, model_util_->GetTreeNodeId(parent)); 238 args.SetString(kId, model_util_->GetTreeNodeId(parent));
232 args.Set(kChildren, std::move(children)); 239 args.Set(kChildren, std::move(children));
233 240
234 ResolveJavascriptCallback(base::StringValue(callback_id_), args); 241 ResolveJavascriptCallback(base::StringValue(callback_id_), args);
235 callback_id_ = ""; 242 callback_id_ = "";
236 } 243 }
237 244
238 void CookiesViewHandler::ReloadCookies(const base::ListValue* args) { 245 void CookiesViewHandler::ReloadCookies(const base::ListValue* args) {
239 CHECK_EQ(1U, args->GetSize()); 246 CHECK_EQ(1U, args->GetSize());
240 CHECK(args->GetString(0, &callback_id_)); 247 CHECK(args->GetString(0, &callback_id_));
241 248
242 cookies_tree_model_.reset(); 249 cookies_tree_model_.reset();
243 250
244 EnsureCookiesTreeModelCreated(); 251 EnsureCookiesTreeModelCreated();
245 } 252 }
246 253
247 } // namespace settings 254 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698