OLD | NEW |
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_SITE_LIST_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SITE_LIST_H_ |
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SITE_LIST_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SITE_LIST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // for the site. | 53 // for the site. |
54 std::vector<std::string> hostname_hashes; | 54 std::vector<std::string> hostname_hashes; |
55 | 55 |
56 // Copying and assignment is allowed. | 56 // Copying and assignment is allowed. |
57 }; | 57 }; |
58 | 58 |
59 // Asynchronously loads the site list from |file| and calls |callback| with | 59 // Asynchronously loads the site list from |file| and calls |callback| with |
60 // the newly created object. | 60 // the newly created object. |
61 static void Load(const base::FilePath& file, const LoadedCallback& callback); | 61 static void Load(const base::FilePath& file, const LoadedCallback& callback); |
62 | 62 |
63 // Sets whether the site list should be loaded in-process or out-of-process. | |
64 // In-process loading should only be used in tests (to avoid having to set up | |
65 // child process handling). | |
66 static void SetLoadInProcessForTesting(bool in_process); | |
67 | |
68 // Returns a list of all sites in this site list. | 63 // Returns a list of all sites in this site list. |
69 const std::vector<Site>& sites() const { return sites_; } | 64 const std::vector<Site>& sites() const { return sites_; } |
70 | 65 |
71 private: | 66 private: |
72 friend class base::RefCountedThreadSafe<SupervisedUserSiteList>; | 67 friend class base::RefCountedThreadSafe<SupervisedUserSiteList>; |
73 | 68 |
74 explicit SupervisedUserSiteList(const base::ListValue& sites); | 69 explicit SupervisedUserSiteList(const base::ListValue& sites); |
75 ~SupervisedUserSiteList(); | 70 ~SupervisedUserSiteList(); |
76 | 71 |
77 // Static private so they can access the private constructor. | 72 // Static private so they can access the private constructor. |
78 static void ParseJson(const base::FilePath& path, | 73 static void ParseJson(const base::FilePath& path, |
79 const SupervisedUserSiteList::LoadedCallback& callback, | 74 const SupervisedUserSiteList::LoadedCallback& callback, |
80 const std::string& json); | 75 const std::string& json); |
81 static void OnJsonParseSucceeded( | 76 static void OnJsonParseSucceeded( |
82 const base::FilePath& path, | 77 const base::FilePath& path, |
83 base::TimeTicks start_time, | 78 base::TimeTicks start_time, |
84 const SupervisedUserSiteList::LoadedCallback& callback, | 79 const SupervisedUserSiteList::LoadedCallback& callback, |
85 scoped_ptr<base::Value> value); | 80 scoped_ptr<base::Value> value); |
86 | 81 |
87 std::vector<Site> sites_; | 82 std::vector<Site> sites_; |
88 | 83 |
89 DISALLOW_COPY_AND_ASSIGN(SupervisedUserSiteList); | 84 DISALLOW_COPY_AND_ASSIGN(SupervisedUserSiteList); |
90 }; | 85 }; |
91 | 86 |
92 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SITE_LIST_H_ | 87 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SITE_LIST_H_ |
OLD | NEW |