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

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

Issue 1443033004: Supervised User whitelists: update to json format v2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: title Created 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SUPERVISED_USER_SUPERVISED_USER_WHITELIST_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_WHITELIST_SERVICE_H_
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_WHITELIST_SERVICE_H_ 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_WHITELIST_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/strings/string16.h"
Bernhard Bauer 2015/11/18 12:10:40 Same here: you can forward-declare string16.
Marc Treib 2015/11/18 12:44:19 Dito.
15 #include "base/time/time.h" 16 #include "base/time/time.h"
16 #include "chrome/browser/supervised_user/supervised_users.h" 17 #include "chrome/browser/supervised_user/supervised_users.h"
17 #include "sync/api/syncable_service.h" 18 #include "sync/api/syncable_service.h"
18 19
19 class PrefService; 20 class PrefService;
20 class SupervisedUserSiteList; 21 class SupervisedUserSiteList;
21 22
22 namespace base { 23 namespace base {
23 class DictionaryValue; 24 class DictionaryValue;
24 class FilePath; 25 class FilePath;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // site lists. 58 // site lists.
58 void AddSiteListsChangedCallback(const SiteListsChangedCallback& callback); 59 void AddSiteListsChangedCallback(const SiteListsChangedCallback& callback);
59 60
60 // Returns a map (from CRX ID to name) of whitelists to be installed, 61 // Returns a map (from CRX ID to name) of whitelists to be installed,
61 // specified on the command line. 62 // specified on the command line.
62 static std::map<std::string, std::string> GetWhitelistsFromCommandLine(); 63 static std::map<std::string, std::string> GetWhitelistsFromCommandLine();
63 64
64 // Loads an already existing whitelist on disk (i.e. without downloading it as 65 // Loads an already existing whitelist on disk (i.e. without downloading it as
65 // a component). 66 // a component).
66 void LoadWhitelistForTesting(const std::string& id, 67 void LoadWhitelistForTesting(const std::string& id,
68 const base::string16& title,
67 const base::FilePath& path); 69 const base::FilePath& path);
68 70
69 // Unloads a whitelist. Public for testing. 71 // Unloads a whitelist. Public for testing.
70 void UnloadWhitelist(const std::string& id); 72 void UnloadWhitelist(const std::string& id);
71 73
72 // Creates Sync data for a whitelist with the given |id| and |name|. 74 // Creates Sync data for a whitelist with the given |id| and |name|.
73 // Public for testing. 75 // Public for testing.
74 static syncer::SyncData CreateWhitelistSyncData(const std::string& id, 76 static syncer::SyncData CreateWhitelistSyncData(const std::string& id,
75 const std::string& name); 77 const std::string& name);
76 78
(...skipping 28 matching lines...) Expand all
105 void RegisterWhitelist(const std::string& id, 107 void RegisterWhitelist(const std::string& id,
106 const std::string& name, 108 const std::string& name,
107 WhitelistSource source); 109 WhitelistSource source);
108 110
109 void GetLoadedWhitelists( 111 void GetLoadedWhitelists(
110 std::vector<scoped_refptr<SupervisedUserSiteList>>* whitelists); 112 std::vector<scoped_refptr<SupervisedUserSiteList>>* whitelists);
111 113
112 void NotifyWhitelistsChanged(); 114 void NotifyWhitelistsChanged();
113 115
114 void OnWhitelistReady(const std::string& id, 116 void OnWhitelistReady(const std::string& id,
117 const base::string16& title,
115 const base::FilePath& whitelist_path); 118 const base::FilePath& whitelist_path);
116 void OnWhitelistLoaded( 119 void OnWhitelistLoaded(
117 const std::string& id, 120 const std::string& id,
118 base::TimeTicks start_time, 121 base::TimeTicks start_time,
119 const scoped_refptr<SupervisedUserSiteList>& whitelist); 122 const scoped_refptr<SupervisedUserSiteList>& whitelist);
120 123
121 PrefService* prefs_; 124 PrefService* prefs_;
122 component_updater::SupervisedUserWhitelistInstaller* installer_; 125 component_updater::SupervisedUserWhitelistInstaller* installer_;
123 126
124 std::string client_id_; 127 std::string client_id_;
125 std::vector<SiteListsChangedCallback> site_lists_changed_callbacks_; 128 std::vector<SiteListsChangedCallback> site_lists_changed_callbacks_;
126 129
127 // The set of registered whitelists. A whitelist might be registered but not 130 // The set of registered whitelists. A whitelist might be registered but not
128 // loaded yet, in which case it will not be in |loaded_whitelists_| yet. 131 // loaded yet, in which case it will not be in |loaded_whitelists_| yet.
129 // On the other hand, every loaded whitelist has to be registered. 132 // On the other hand, every loaded whitelist has to be registered.
130 std::set<std::string> registered_whitelists_; 133 std::set<std::string> registered_whitelists_;
131 std::map<std::string, scoped_refptr<SupervisedUserSiteList> > 134 std::map<std::string, scoped_refptr<SupervisedUserSiteList> >
132 loaded_whitelists_; 135 loaded_whitelists_;
133 136
134 base::WeakPtrFactory<SupervisedUserWhitelistService> weak_ptr_factory_; 137 base::WeakPtrFactory<SupervisedUserWhitelistService> weak_ptr_factory_;
135 138
136 DISALLOW_COPY_AND_ASSIGN(SupervisedUserWhitelistService); 139 DISALLOW_COPY_AND_ASSIGN(SupervisedUserWhitelistService);
137 }; 140 };
138 141
139 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_WHITELIST_SERVICE_H_ 142 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_WHITELIST_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698