Index: chrome/browser/supervised_user/supervised_user_site_list.h |
diff --git a/chrome/browser/supervised_user/supervised_user_site_list.h b/chrome/browser/supervised_user/supervised_user_site_list.h |
index 014611e64ff8dfc3199d7aafaa4175b069b161a9..47cc67fccd73d310dd148e8315714ad23240a42c 100644 |
--- a/chrome/browser/supervised_user/supervised_user_site_list.h |
+++ b/chrome/browser/supervised_user/supervised_user_site_list.h |
@@ -12,7 +12,9 @@ |
#include "base/files/file_path.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/strings/string16.h" |
#include "base/time/time.h" |
+#include "url/gurl.h" |
class Profile; |
@@ -22,60 +24,57 @@ class ListValue; |
class Value; |
} |
-// This class represents a "site list" that is part of a content pack. It is |
+// This class represents the content of a supervised user whitelist. It is |
// loaded from a JSON file inside the extension bundle, which defines the sites |
// on the list. |
-// Every site has -- among other attributes -- a whitelist of URLs that are |
-// required to use it. All sites from all installed content packs together with |
-// their respective whitelists are combined in the SupervisedUserURLFilter, |
-// which can tell for a given URL if it is part of the whitelist for any site. |
-// Effectively, SupervisedUserURLFilter then acts as a big whitelist which is |
-// the union of the whitelists in all sites in all content packs. See |
-// http://goo.gl/cBCB8 for a diagram. |
+// All whitelists are combined in the SupervisedUserURLFilter, which can tell |
+// for a given URL if it is part of any whitelist. Effectively, |
+// SupervisedUserURLFilter then acts as a big whitelist which is the union of |
+// all the whitelists. |
class SupervisedUserSiteList |
: public base::RefCountedThreadSafe<SupervisedUserSiteList> { |
public: |
- typedef base::Callback<void(const scoped_refptr<SupervisedUserSiteList>&)> |
- LoadedCallback; |
- |
- struct Site { |
- explicit Site(const base::string16& name); |
- ~Site(); |
- |
- // The human-readable name for the site. |
- base::string16 name; |
- |
- // A list of URL patterns that should be whitelisted for the site. |
- std::vector<std::string> patterns; |
- |
- // A list of hex-encoded SHA1 hashes of hostnames that should be whitelisted |
- // for the site. |
- std::vector<std::string> hostname_hashes; |
- |
- // Copying and assignment is allowed. |
- }; |
+ using LoadedCallback = |
+ base::Callback<void(const scoped_refptr<SupervisedUserSiteList>&)>; |
// Asynchronously loads the site list from |file| and calls |callback| with |
// the newly created object. |
- static void Load(const base::FilePath& file, const LoadedCallback& callback); |
+ static void Load(const base::string16& title, |
+ const base::FilePath& file, |
+ const LoadedCallback& callback); |
- // Returns a list of all sites in this site list. |
- const std::vector<Site>& sites() const { return sites_; } |
+ const base::string16& title() const { return title_; } |
+ const GURL& entry_point() const { return entry_point_; } |
+ const std::vector<std::string>& patterns() const { return patterns_; } |
+ const std::vector<std::string>& hostname_hashes() const { |
+ return hostname_hashes_; |
+ } |
private: |
friend class base::RefCountedThreadSafe<SupervisedUserSiteList>; |
- explicit SupervisedUserSiteList(const base::ListValue& sites); |
+ explicit SupervisedUserSiteList(const base::string16& title, |
+ GURL entry_point, |
+ const base::ListValue* patterns, |
+ const base::ListValue* hostname_hashes); |
~SupervisedUserSiteList(); |
// Static private so it can access the private constructor. |
static void OnJsonLoaded( |
+ const base::string16& title, |
const base::FilePath& path, |
base::TimeTicks start_time, |
const SupervisedUserSiteList::LoadedCallback& callback, |
scoped_ptr<base::Value> value); |
- std::vector<Site> sites_; |
+ base::string16 title_; |
+ GURL entry_point_; |
+ |
+ // A list of URL patterns that should be whitelisted. |
+ std::vector<std::string> patterns_; |
+ |
+ // A list of hex-encoded SHA1 hashes of hostnames that should be whitelisted. |
+ std::vector<std::string> hostname_hashes_; |
DISALLOW_COPY_AND_ASSIGN(SupervisedUserSiteList); |
}; |