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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // is not valid. | 48 // is not valid. |
49 const CookieTreeNode* GetTreeNodeFromPath(const CookieTreeNode* root, | 49 const CookieTreeNode* GetTreeNodeFromPath(const CookieTreeNode* root, |
50 const std::string& path); | 50 const std::string& path); |
51 | 51 |
52 // Gets tree node from |title| under |root|. |title| is a node title. Return | 52 // Gets tree node from |title| under |root|. |title| is a node title. Return |
53 // NULL if |title| is not found. | 53 // NULL if |title| is not found. |
54 const CookieTreeNode* GetTreeNodeFromTitle(const CookieTreeNode* root, | 54 const CookieTreeNode* GetTreeNodeFromTitle(const CookieTreeNode* root, |
55 const base::string16& title); | 55 const base::string16& title); |
56 | 56 |
57 private: | 57 private: |
58 typedef IDMap<const CookieTreeNode> CookiesTreeNodeIdMap; | 58 using CookiesTreeNodeIdMap = IDMap<const CookieTreeNode*>; |
59 typedef std::map<const CookieTreeNode*, int32_t> CookieTreeNodeMap; | 59 using CookieTreeNodeMap = std::map<const CookieTreeNode*, int32_t>; |
60 | 60 |
61 // Populate given |dict| with cookie tree node properties. |id_map| maps | 61 // Populate given |dict| with cookie tree node properties. |id_map| maps |
62 // a CookieTreeNode to an ID and creates a new ID if |node| is not in the | 62 // a CookieTreeNode to an ID and creates a new ID if |node| is not in the |
63 // maps. Returns false if the |node| does not need to be shown. | 63 // maps. Returns false if the |node| does not need to be shown. |
64 bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, | 64 bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, |
65 bool include_quota_nodes, | 65 bool include_quota_nodes, |
66 base::DictionaryValue* dict); | 66 base::DictionaryValue* dict); |
67 | 67 |
68 // IDMap to create unique ID and look up the object for an ID. | 68 // IDMap to create unique ID and look up the object for an ID. |
69 CookiesTreeNodeIdMap id_map_; | 69 CookiesTreeNodeIdMap id_map_; |
70 | 70 |
71 // Reverse look up map to find the ID for a node. | 71 // Reverse look up map to find the ID for a node. |
72 CookieTreeNodeMap node_map_; | 72 CookieTreeNodeMap node_map_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModelUtil); | 74 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModelUtil); |
75 }; | 75 }; |
76 | 76 |
77 #endif // CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_ | 77 #endif // CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_ |
OLD | NEW |