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 #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 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 14 matching lines...) Expand all Loading... |
25 CookiesTreeModelUtil(); | 25 CookiesTreeModelUtil(); |
26 ~CookiesTreeModelUtil(); | 26 ~CookiesTreeModelUtil(); |
27 | 27 |
28 // Finds or creates an ID for given |node| and returns it as string. | 28 // Finds or creates an ID for given |node| and returns it as string. |
29 std::string GetTreeNodeId(const CookieTreeNode* node); | 29 std::string GetTreeNodeId(const CookieTreeNode* node); |
30 | 30 |
31 // Append the children nodes of |parent| in specified range to |nodes| list. | 31 // Append the children nodes of |parent| in specified range to |nodes| list. |
32 void GetChildNodeList(const CookieTreeNode* parent, | 32 void GetChildNodeList(const CookieTreeNode* parent, |
33 int start, | 33 int start, |
34 int count, | 34 int count, |
| 35 bool include_quota_nodes, |
35 base::ListValue* nodes); | 36 base::ListValue* nodes); |
36 | 37 |
37 // Gets tree node from |path| under |root|. |path| is comma separated list of | 38 // Gets tree node from |path| under |root|. |path| is comma separated list of |
38 // ids. |id_map| translates ids into object pointers. Return NULL if |path| | 39 // ids. |id_map| translates ids into object pointers. Return NULL if |path| |
39 // is not valid. | 40 // is not valid. |
40 const CookieTreeNode* GetTreeNodeFromPath(const CookieTreeNode* root, | 41 const CookieTreeNode* GetTreeNodeFromPath(const CookieTreeNode* root, |
41 const std::string& path); | 42 const std::string& path); |
42 | 43 |
43 private: | 44 private: |
44 typedef IDMap<const CookieTreeNode> CookiesTreeNodeIdMap; | 45 typedef IDMap<const CookieTreeNode> CookiesTreeNodeIdMap; |
45 typedef std::map<const CookieTreeNode*, int32_t> CookieTreeNodeMap; | 46 typedef std::map<const CookieTreeNode*, int32_t> CookieTreeNodeMap; |
46 | 47 |
47 // Populate given |dict| with cookie tree node properties. |id_map| maps | 48 // Populate given |dict| with cookie tree node properties. |id_map| maps |
48 // a CookieTreeNode to an ID and creates a new ID if |node| is not in the | 49 // a CookieTreeNode to an ID and creates a new ID if |node| is not in the |
49 // maps. Returns false if the |node| does not need to be shown. | 50 // maps. Returns false if the |node| does not need to be shown. |
50 bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, | 51 bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, |
| 52 bool include_quota_nodes, |
51 base::DictionaryValue* dict); | 53 base::DictionaryValue* dict); |
52 | 54 |
53 // IDMap to create unique ID and look up the object for an ID. | 55 // IDMap to create unique ID and look up the object for an ID. |
54 CookiesTreeNodeIdMap id_map_; | 56 CookiesTreeNodeIdMap id_map_; |
55 | 57 |
56 // Reverse look up map to find the ID for a node. | 58 // Reverse look up map to find the ID for a node. |
57 CookieTreeNodeMap node_map_; | 59 CookieTreeNodeMap node_map_; |
58 | 60 |
59 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModelUtil); | 61 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModelUtil); |
60 }; | 62 }; |
61 | 63 |
62 #endif // CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_ | 64 #endif // CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_ |
OLD | NEW |