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