OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/options/cookies_view_handler.h" | 5 #include "chrome/browser/ui/webui/options/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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 int start, | 140 int start, |
141 int count) { | 141 int count) { |
142 // Skip if there is a batch update in progress. | 142 // Skip if there is a batch update in progress. |
143 if (batch_update_) | 143 if (batch_update_) |
144 return; | 144 return; |
145 | 145 |
146 CookiesTreeModel* tree_model = static_cast<CookiesTreeModel*>(model); | 146 CookiesTreeModel* tree_model = static_cast<CookiesTreeModel*>(model); |
147 CookieTreeNode* parent_node = tree_model->AsNode(parent); | 147 CookieTreeNode* parent_node = tree_model->AsNode(parent); |
148 | 148 |
149 std::unique_ptr<base::ListValue> children(new base::ListValue); | 149 std::unique_ptr<base::ListValue> children(new base::ListValue); |
150 model_util_->GetChildNodeList(parent_node, start, count, children.get()); | 150 model_util_->GetChildNodeList( |
| 151 parent_node, start, count, /*include_quota_nodes=*/true, children.get()); |
151 | 152 |
152 base::ListValue args; | 153 base::ListValue args; |
153 if (parent == tree_model->GetRoot()) | 154 if (parent == tree_model->GetRoot()) |
154 args.Append(base::Value::CreateNullValue()); | 155 args.Append(base::Value::CreateNullValue()); |
155 else | 156 else |
156 args.AppendString(model_util_->GetTreeNodeId(parent_node)); | 157 args.AppendString(model_util_->GetTreeNodeId(parent_node)); |
157 args.AppendInteger(start); | 158 args.AppendInteger(start); |
158 args.Append(std::move(children)); | 159 args.Append(std::move(children)); |
159 web_ui()->CallJavascriptFunctionUnsafe("CookiesView.onTreeItemAdded", args); | 160 web_ui()->CallJavascriptFunctionUnsafe("CookiesView.onTreeItemAdded", args); |
160 } | 161 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 EnsureCookiesTreeModelCreated(); | 259 EnsureCookiesTreeModelCreated(); |
259 | 260 |
260 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( | 261 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( |
261 cookies_tree_model_->GetRoot(), node_path); | 262 cookies_tree_model_->GetRoot(), node_path); |
262 if (node) | 263 if (node) |
263 SendChildren(node); | 264 SendChildren(node); |
264 } | 265 } |
265 | 266 |
266 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { | 267 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { |
267 std::unique_ptr<base::ListValue> children(new base::ListValue); | 268 std::unique_ptr<base::ListValue> children(new base::ListValue); |
268 model_util_->GetChildNodeList(parent, 0, parent->child_count(), | 269 model_util_->GetChildNodeList(parent, /*start=*/0, parent->child_count(), |
269 children.get()); | 270 /*include_quota_nodes=*/true, children.get()); |
270 | 271 |
271 base::ListValue args; | 272 base::ListValue args; |
272 if (parent == cookies_tree_model_->GetRoot()) | 273 if (parent == cookies_tree_model_->GetRoot()) |
273 args.Append(base::Value::CreateNullValue()); | 274 args.Append(base::Value::CreateNullValue()); |
274 else | 275 else |
275 args.AppendString(model_util_->GetTreeNodeId(parent)); | 276 args.AppendString(model_util_->GetTreeNodeId(parent)); |
276 args.Append(std::move(children)); | 277 args.Append(std::move(children)); |
277 | 278 |
278 web_ui()->CallJavascriptFunctionUnsafe("CookiesView.loadChildren", args); | 279 web_ui()->CallJavascriptFunctionUnsafe("CookiesView.loadChildren", args); |
279 } | 280 } |
280 | 281 |
281 void CookiesViewHandler::ReloadCookies(const base::ListValue* args) { | 282 void CookiesViewHandler::ReloadCookies(const base::ListValue* args) { |
282 cookies_tree_model_.reset(); | 283 cookies_tree_model_.reset(); |
283 | 284 |
284 EnsureCookiesTreeModelCreated(); | 285 EnsureCookiesTreeModelCreated(); |
285 } | 286 } |
286 | 287 |
287 } // namespace options | 288 } // namespace options |
OLD | NEW |