Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: chrome/browser/ui/webui/cookies_tree_model_util.h

Issue 2476753002: [MD settings] get cookie details from site without transfering cookie tree (Closed)
Patch Set: touchups Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <string> 11 #include <string>
12 12
13 #include "base/id_map.h" 13 #include "base/id_map.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/strings/string16.h"
15 16
16 class CookieTreeNode; 17 class CookieTreeNode;
17 18
18 namespace base { 19 namespace base {
19 class DictionaryValue; 20 class DictionaryValue;
20 class ListValue; 21 class ListValue;
21 } 22 }
22 23
23 class CookiesTreeModelUtil { 24 class CookiesTreeModelUtil {
24 public: 25 public:
25 CookiesTreeModelUtil(); 26 CookiesTreeModelUtil();
26 ~CookiesTreeModelUtil(); 27 ~CookiesTreeModelUtil();
27 28
28 // Finds or creates an ID for given |node| and returns it as string. 29 // Finds or creates an ID for given |node| and returns it as string.
29 std::string GetTreeNodeId(const CookieTreeNode* node); 30 std::string GetTreeNodeId(const CookieTreeNode* node);
30 31
32 // Append the details of the child nodes of |parent| in specified range.
33 void GetChildNodeDetails(const CookieTreeNode* parent,
34 int start,
35 int count,
36 bool include_quota_nodes,
37 base::ListValue* list);
38
31 // Append the children nodes of |parent| in specified range to |nodes| list. 39 // Append the children nodes of |parent| in specified range to |nodes| list.
32 void GetChildNodeList(const CookieTreeNode* parent, 40 void GetChildNodeList(const CookieTreeNode* parent,
33 int start, 41 int start,
34 int count, 42 int count,
35 bool include_quota_nodes, 43 bool include_quota_nodes,
36 base::ListValue* nodes); 44 base::ListValue* nodes);
37 45
38 // Gets tree node from |path| under |root|. |path| is comma separated list of 46 // Gets tree node from |path| under |root|. |path| is comma separated list of
39 // ids. |id_map| translates ids into object pointers. Return NULL if |path| 47 // ids. |id_map| translates ids into object pointers. Return NULL if |path|
40 // is not valid. 48 // is not valid.
41 const CookieTreeNode* GetTreeNodeFromPath(const CookieTreeNode* root, 49 const CookieTreeNode* GetTreeNodeFromPath(const CookieTreeNode* root,
42 const std::string& path); 50 const std::string& path);
43 51
52 // Gets tree node from |title| under |root|. |title| is a node title. Return
53 // NULL if |title| is not found.
54 // is not valid.
Dan Beam 2016/11/04 00:35:31 ^
dschuyler 2016/11/04 00:50:44 Done.
55 const CookieTreeNode* GetTreeNodeFromTitle(const CookieTreeNode* root,
56 const base::string16& title);
57
44 private: 58 private:
45 typedef IDMap<const CookieTreeNode> CookiesTreeNodeIdMap; 59 typedef IDMap<const CookieTreeNode> CookiesTreeNodeIdMap;
46 typedef std::map<const CookieTreeNode*, int32_t> CookieTreeNodeMap; 60 typedef std::map<const CookieTreeNode*, int32_t> CookieTreeNodeMap;
47 61
48 // Populate given |dict| with cookie tree node properties. |id_map| maps 62 // Populate given |dict| with cookie tree node properties. |id_map| maps
49 // a CookieTreeNode to an ID and creates a new ID if |node| is not in the 63 // a CookieTreeNode to an ID and creates a new ID if |node| is not in the
50 // maps. Returns false if the |node| does not need to be shown. 64 // maps. Returns false if the |node| does not need to be shown.
51 bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, 65 bool GetCookieTreeNodeDictionary(const CookieTreeNode& node,
52 bool include_quota_nodes, 66 bool include_quota_nodes,
53 base::DictionaryValue* dict); 67 base::DictionaryValue* dict);
54 68
55 // IDMap to create unique ID and look up the object for an ID. 69 // IDMap to create unique ID and look up the object for an ID.
56 CookiesTreeNodeIdMap id_map_; 70 CookiesTreeNodeIdMap id_map_;
57 71
58 // Reverse look up map to find the ID for a node. 72 // Reverse look up map to find the ID for a node.
59 CookieTreeNodeMap node_map_; 73 CookieTreeNodeMap node_map_;
60 74
61 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModelUtil); 75 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModelUtil);
62 }; 76 };
63 77
64 #endif // CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_ 78 #endif // CHROME_BROWSER_UI_WEBUI_COOKIES_TREE_MODEL_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698