| 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 #ifndef CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 class CookieTreeNode; | 11 class CookieTreeNode; |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class DictionaryValue; | 14 class DictionaryValue; |
| 15 class ListValue; | 15 class ListValue; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace cookies_tree_model_util { | 18 namespace cookies_tree_model_util { |
| 19 | 19 |
| 20 // Returns tree node id. Currently use hex string of node pointer as id. | 20 // Returns tree node id. Currently use hex string of node pointer as id. |
| 21 std::string GetTreeNodeId(CookieTreeNode* node); | 21 std::string GetTreeNodeId(CookieTreeNode* node); |
| 22 | 22 |
| 23 // Populate given |dict| with cookie tree node properties. | 23 // Populate given |dict| with cookie tree node properties. |
| 24 void GetCookieTreeNodeDictionary(const CookieTreeNode& node, | 24 // Returns false if the |node| does not need to be shown. |
| 25 bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, |
| 25 base::DictionaryValue* dict); | 26 base::DictionaryValue* dict); |
| 26 | 27 |
| 27 // Append the children nodes of |parent| in specified range to |nodes| list. | 28 // Append the children nodes of |parent| in specified range to |nodes| list. |
| 28 void GetChildNodeList(CookieTreeNode* parent, int start, int count, | 29 void GetChildNodeList(CookieTreeNode* parent, int start, int count, |
| 29 base::ListValue* nodes); | 30 base::ListValue* nodes); |
| 30 | 31 |
| 31 // Gets tree node from |path| under |root|. Return NULL if |path| is not valid. | 32 // Gets tree node from |path| under |root|. Return NULL if |path| is not valid. |
| 32 CookieTreeNode* GetTreeNodeFromPath(CookieTreeNode* root, | 33 CookieTreeNode* GetTreeNodeFromPath(CookieTreeNode* root, |
| 33 const std::string& path); | 34 const std::string& path); |
| 34 | 35 |
| 35 } // namespace cookies_tree_model_util | 36 } // namespace cookies_tree_model_util |
| 36 | 37 |
| 37 #endif // CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_ | 38 #endif // CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_ |
| OLD | NEW |