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 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" | 15 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
15 #include "chrome/browser/browsing_data/browsing_data_cache_storage_helper.h" | 16 #include "chrome/browser/browsing_data/browsing_data_cache_storage_helper.h" |
16 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" | 17 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" |
17 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 18 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 148 |
148 scoped_ptr<base::ListValue> children(new base::ListValue); | 149 scoped_ptr<base::ListValue> children(new base::ListValue); |
149 model_util_->GetChildNodeList(parent_node, start, count, children.get()); | 150 model_util_->GetChildNodeList(parent_node, start, count, children.get()); |
150 | 151 |
151 base::ListValue args; | 152 base::ListValue args; |
152 if (parent == tree_model->GetRoot()) | 153 if (parent == tree_model->GetRoot()) |
153 args.Append(base::Value::CreateNullValue()); | 154 args.Append(base::Value::CreateNullValue()); |
154 else | 155 else |
155 args.AppendString(model_util_->GetTreeNodeId(parent_node)); | 156 args.AppendString(model_util_->GetTreeNodeId(parent_node)); |
156 args.AppendInteger(start); | 157 args.AppendInteger(start); |
157 args.Append(children.Pass()); | 158 args.Append(std::move(children)); |
158 web_ui()->CallJavascriptFunction("CookiesView.onTreeItemAdded", args); | 159 web_ui()->CallJavascriptFunction("CookiesView.onTreeItemAdded", args); |
159 } | 160 } |
160 | 161 |
161 void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model, | 162 void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model, |
162 ui::TreeModelNode* parent, | 163 ui::TreeModelNode* parent, |
163 int start, | 164 int start, |
164 int count) { | 165 int count) { |
165 // Skip if there is a batch update in progress. | 166 // Skip if there is a batch update in progress. |
166 if (batch_update_) | 167 if (batch_update_) |
167 return; | 168 return; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { | 268 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { |
268 scoped_ptr<base::ListValue> children(new base::ListValue); | 269 scoped_ptr<base::ListValue> children(new base::ListValue); |
269 model_util_->GetChildNodeList(parent, 0, parent->child_count(), | 270 model_util_->GetChildNodeList(parent, 0, parent->child_count(), |
270 children.get()); | 271 children.get()); |
271 | 272 |
272 base::ListValue args; | 273 base::ListValue args; |
273 if (parent == cookies_tree_model_->GetRoot()) | 274 if (parent == cookies_tree_model_->GetRoot()) |
274 args.Append(base::Value::CreateNullValue()); | 275 args.Append(base::Value::CreateNullValue()); |
275 else | 276 else |
276 args.AppendString(model_util_->GetTreeNodeId(parent)); | 277 args.AppendString(model_util_->GetTreeNodeId(parent)); |
277 args.Append(children.Pass()); | 278 args.Append(std::move(children)); |
278 | 279 |
279 web_ui()->CallJavascriptFunction("CookiesView.loadChildren", args); | 280 web_ui()->CallJavascriptFunction("CookiesView.loadChildren", args); |
280 } | 281 } |
281 | 282 |
282 void CookiesViewHandler::ReloadCookies(const base::ListValue* args) { | 283 void CookiesViewHandler::ReloadCookies(const base::ListValue* args) { |
283 cookies_tree_model_.reset(); | 284 cookies_tree_model_.reset(); |
284 | 285 |
285 EnsureCookiesTreeModelCreated(); | 286 EnsureCookiesTreeModelCreated(); |
286 } | 287 } |
287 | 288 |
288 } // namespace options | 289 } // namespace options |
OLD | NEW |