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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_bookmarks_handler.h

Issue 769153007: Managed bookmarks for supervised users (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: string change Created 5 years, 11 months 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
noyau (Ping after 24h) 2015/01/23 12:14:52 2015 on new files :)
Marc Treib 2015/01/26 12:27:42 Thanks, done!
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_BOOKMARKS_HANDLER_H_
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_BOOKMARKS_HANDLER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13
14 namespace base {
15 class DictionaryValue;
16 class ListValue;
17 }
18
19 // This class converts bookmarks from supervised user settings into a tree of
20 // base::Values, for use in bookmarks::prefs::kSupervisedBookmarks.
21 class SupervisedUserBookmarksHandler {
22 public:
23 static scoped_ptr<base::ListValue> BuildBookmarksTree(
24 const base::DictionaryValue& settings);
25
26 // Public for testing only.
noyau (Ping after 24h) 2015/01/23 12:14:52 The testing class is listed as friend, does these
Marc Treib 2015/01/26 12:27:42 Yes, it's also used in the test outside of the act
27 struct Folder {
28 Folder(int id, const std::string& name, int parent_id);
29
30 int id;
31 std::string name;
32 int parent_id;
33 };
34
35 struct Link {
36 Link(const std::string& url, const std::string& name, int parent_id);
37
38 std::string url;
39 std::string name;
40 int parent_id;
41 };
42
43 private:
44 friend class SupervisedUserBookmarksHandlerTest;
45
46 SupervisedUserBookmarksHandler();
47 ~SupervisedUserBookmarksHandler();
48
49 void ParseSettings(const base::DictionaryValue& settings);
50 void ParseFolders(const base::DictionaryValue& folders);
51 void ParseLinks(const base::DictionaryValue& links);
52 scoped_ptr<base::ListValue> BuildTree();
53 void AddFoldersToTree();
54 void AddLinksToTree();
55 bool AddNodeToTree(int parent_id, scoped_ptr<base::DictionaryValue> node);
56
57 const std::vector<Folder>& folders_for_testing() const { return folders_; }
58 const std::vector<Link>& links_for_testing() const { return links_; }
59
60 std::vector<Folder> folders_;
61 std::vector<Link> links_;
62
63 scoped_ptr<base::ListValue> root_;
64
65 DISALLOW_COPY_AND_ASSIGN(SupervisedUserBookmarksHandler);
66 };
67
68 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_BOOKMARKS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698