OLD | NEW |
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 // Helper class loads models for client-side phishing detection | 5 // Helper class loads models for client-side phishing detection |
6 // from the the SafeBrowsing backends. | 6 // from the the SafeBrowsing backends. |
7 // | 7 // |
8 // This class is not thread-safe and expects all calls to be made on the UI | 8 // This class is not thread-safe and expects all calls to be made on the UI |
9 // thread. | 9 // thread. |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 MODEL_EMPTY, | 76 MODEL_EMPTY, |
77 MODEL_TOO_LARGE, | 77 MODEL_TOO_LARGE, |
78 MODEL_PARSE_ERROR, | 78 MODEL_PARSE_ERROR, |
79 MODEL_MISSING_FIELDS, | 79 MODEL_MISSING_FIELDS, |
80 MODEL_INVALID_VERSION_NUMBER, | 80 MODEL_INVALID_VERSION_NUMBER, |
81 MODEL_BAD_HASH_IDS, | 81 MODEL_BAD_HASH_IDS, |
82 MODEL_STATUS_MAX // Always add new values before this one. | 82 MODEL_STATUS_MAX // Always add new values before this one. |
83 }; | 83 }; |
84 | 84 |
85 // For testing only. | 85 // For testing only. |
86 ModelLoader(base::Closure update_renderers, const std::string model_name); | 86 ModelLoader(base::Closure update_renderers, const std::string& model_name); |
87 | 87 |
88 // This is called periodically to check whether a new client model is | 88 // This is called periodically to check whether a new client model is |
89 // available for download. | 89 // available for download. |
90 virtual void StartFetch(); | 90 virtual void StartFetch(); |
91 | 91 |
92 // This method is called when we're done fetching the model either because | 92 // This method is called when we're done fetching the model either because |
93 // we hit an error somewhere or because we're actually done fetch and | 93 // we hit an error somewhere or because we're actually done fetch and |
94 // validating the model. If |max_age| is not 0, it's used to schedule the | 94 // validating the model. If |max_age| is not 0, it's used to schedule the |
95 // next fetch. | 95 // next fetch. |
96 virtual void EndFetch(ClientModelStatus status, base::TimeDelta max_age); | 96 virtual void EndFetch(ClientModelStatus status, base::TimeDelta max_age); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 FRIEND_TEST_ALL_PREFIXES(ModelLoaderTest, RescheduleFetchTest); | 134 FRIEND_TEST_ALL_PREFIXES(ModelLoaderTest, RescheduleFetchTest); |
135 FRIEND_TEST_ALL_PREFIXES(ModelLoaderTest, UpdateRenderersTest); | 135 FRIEND_TEST_ALL_PREFIXES(ModelLoaderTest, UpdateRenderersTest); |
136 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, | 136 FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, |
137 SetEnabledAndRefreshState); | 137 SetEnabledAndRefreshState); |
138 DISALLOW_COPY_AND_ASSIGN(ModelLoader); | 138 DISALLOW_COPY_AND_ASSIGN(ModelLoader); |
139 }; | 139 }; |
140 | 140 |
141 } // namespace safe_browsing | 141 } // namespace safe_browsing |
142 | 142 |
143 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_MODEL_LOADER_H_ | 143 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_MODEL_LOADER_H_ |
OLD | NEW |