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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 ui::TreeModelNode* parent, | 139 ui::TreeModelNode* parent, |
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 scoped_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(parent_node, start, count, children.get()); |
151 | 151 |
152 base::ListValue args; | 152 base::ListValue args; |
153 if (parent == tree_model->GetRoot()) | 153 if (parent == tree_model->GetRoot()) |
154 args.Append(base::Value::CreateNullValue()); | 154 args.Append(base::Value::CreateNullValue()); |
155 else | 155 else |
156 args.AppendString(model_util_->GetTreeNodeId(parent_node)); | 156 args.AppendString(model_util_->GetTreeNodeId(parent_node)); |
157 args.AppendInteger(start); | 157 args.AppendInteger(start); |
158 args.Append(std::move(children)); | 158 args.Append(std::move(children)); |
159 web_ui()->CallJavascriptFunction("CookiesView.onTreeItemAdded", args); | 159 web_ui()->CallJavascriptFunction("CookiesView.onTreeItemAdded", args); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 EnsureCookiesTreeModelCreated(); | 260 EnsureCookiesTreeModelCreated(); |
261 | 261 |
262 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( | 262 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( |
263 cookies_tree_model_->GetRoot(), node_path); | 263 cookies_tree_model_->GetRoot(), node_path); |
264 if (node) | 264 if (node) |
265 SendChildren(node); | 265 SendChildren(node); |
266 } | 266 } |
267 | 267 |
268 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { | 268 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { |
269 scoped_ptr<base::ListValue> children(new base::ListValue); | 269 std::unique_ptr<base::ListValue> children(new base::ListValue); |
270 model_util_->GetChildNodeList(parent, 0, parent->child_count(), | 270 model_util_->GetChildNodeList(parent, 0, parent->child_count(), |
271 children.get()); | 271 children.get()); |
272 | 272 |
273 base::ListValue args; | 273 base::ListValue args; |
274 if (parent == cookies_tree_model_->GetRoot()) | 274 if (parent == cookies_tree_model_->GetRoot()) |
275 args.Append(base::Value::CreateNullValue()); | 275 args.Append(base::Value::CreateNullValue()); |
276 else | 276 else |
277 args.AppendString(model_util_->GetTreeNodeId(parent)); | 277 args.AppendString(model_util_->GetTreeNodeId(parent)); |
278 args.Append(std::move(children)); | 278 args.Append(std::move(children)); |
279 | 279 |
280 web_ui()->CallJavascriptFunction("CookiesView.loadChildren", args); | 280 web_ui()->CallJavascriptFunction("CookiesView.loadChildren", args); |
281 } | 281 } |
282 | 282 |
283 void CookiesViewHandler::ReloadCookies(const base::ListValue* args) { | 283 void CookiesViewHandler::ReloadCookies(const base::ListValue* args) { |
284 cookies_tree_model_.reset(); | 284 cookies_tree_model_.reset(); |
285 | 285 |
286 EnsureCookiesTreeModelCreated(); | 286 EnsureCookiesTreeModelCreated(); |
287 } | 287 } |
288 | 288 |
289 } // namespace options | 289 } // namespace options |
OLD | NEW |