| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/browsing_data_appcache_helper.h" | 9 #include "chrome/browser/browsing_data_appcache_helper.h" |
| 10 #include "chrome/browser/browsing_data_cookie_helper.h" | 10 #include "chrome/browser/browsing_data_cookie_helper.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return; | 95 return; |
| 96 | 96 |
| 97 CookieTreeNode* parent_node = cookies_tree_model_->AsNode(parent); | 97 CookieTreeNode* parent_node = cookies_tree_model_->AsNode(parent); |
| 98 | 98 |
| 99 ListValue* children = new ListValue; | 99 ListValue* children = new ListValue; |
| 100 cookies_tree_model_util::GetChildNodeList(parent_node, start, count, | 100 cookies_tree_model_util::GetChildNodeList(parent_node, start, count, |
| 101 children); | 101 children); |
| 102 | 102 |
| 103 ListValue args; | 103 ListValue args; |
| 104 args.Append(parent == cookies_tree_model_->GetRoot() ? | 104 args.Append(parent == cookies_tree_model_->GetRoot() ? |
| 105 Value::CreateNullValue() : | 105 base::NullValue() : |
| 106 Value::CreateStringValue( | 106 Value::CreateStringValue( |
| 107 cookies_tree_model_util::GetTreeNodeId(parent_node))); | 107 cookies_tree_model_util::GetTreeNodeId(parent_node))); |
| 108 args.Append(Value::CreateIntegerValue(start)); | 108 args.Append(Value::CreateIntegerValue(start)); |
| 109 args.Append(children); | 109 args.Append(children); |
| 110 web_ui_->CallJavascriptFunction("CookiesView.onTreeItemAdded", args); | 110 web_ui_->CallJavascriptFunction("CookiesView.onTreeItemAdded", args); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model, | 113 void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model, |
| 114 ui::TreeModelNode* parent, | 114 ui::TreeModelNode* parent, |
| 115 int start, | 115 int start, |
| 116 int count) { | 116 int count) { |
| 117 // Skip if there is a batch update in progress. | 117 // Skip if there is a batch update in progress. |
| 118 if (batch_update_) | 118 if (batch_update_) |
| 119 return; | 119 return; |
| 120 | 120 |
| 121 ListValue args; | 121 ListValue args; |
| 122 args.Append(parent == cookies_tree_model_->GetRoot() ? | 122 args.Append(parent == cookies_tree_model_->GetRoot() ? |
| 123 Value::CreateNullValue() : | 123 base::NullValue() : |
| 124 Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId( | 124 Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId( |
| 125 cookies_tree_model_->AsNode(parent)))); | 125 cookies_tree_model_->AsNode(parent)))); |
| 126 args.Append(Value::CreateIntegerValue(start)); | 126 args.Append(Value::CreateIntegerValue(start)); |
| 127 args.Append(Value::CreateIntegerValue(count)); | 127 args.Append(Value::CreateIntegerValue(count)); |
| 128 web_ui_->CallJavascriptFunction("CookiesView.onTreeItemRemoved", args); | 128 web_ui_->CallJavascriptFunction("CookiesView.onTreeItemRemoved", args); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void CookiesViewHandler::TreeModelBeginBatch(CookiesTreeModel* model) { | 131 void CookiesViewHandler::TreeModelBeginBatch(CookiesTreeModel* model) { |
| 132 DCHECK(!batch_update_); // There should be no nested batch begin. | 132 DCHECK(!batch_update_); // There should be no nested batch begin. |
| 133 batch_update_ = true; | 133 batch_update_ = true; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 SendChildren(node); | 201 SendChildren(node); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void CookiesViewHandler::SendChildren(CookieTreeNode* parent) { | 204 void CookiesViewHandler::SendChildren(CookieTreeNode* parent) { |
| 205 ListValue* children = new ListValue; | 205 ListValue* children = new ListValue; |
| 206 cookies_tree_model_util::GetChildNodeList(parent, 0, parent->child_count(), | 206 cookies_tree_model_util::GetChildNodeList(parent, 0, parent->child_count(), |
| 207 children); | 207 children); |
| 208 | 208 |
| 209 ListValue args; | 209 ListValue args; |
| 210 args.Append(parent == cookies_tree_model_->GetRoot() ? | 210 args.Append(parent == cookies_tree_model_->GetRoot() ? |
| 211 Value::CreateNullValue() : | 211 base::NullValue() : |
| 212 Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId(parent))); | 212 Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId(parent))); |
| 213 args.Append(children); | 213 args.Append(children); |
| 214 | 214 |
| 215 web_ui_->CallJavascriptFunction("CookiesView.loadChildren", args); | 215 web_ui_->CallJavascriptFunction("CookiesView.loadChildren", args); |
| 216 } | 216 } |
| OLD | NEW |