| 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  | 
|   11 #ifndef CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_MODEL_LOADER_H_ |   11 #ifndef CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_MODEL_LOADER_H_ | 
|   12 #define CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_MODEL_LOADER_H_ |   12 #define CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_MODEL_LOADER_H_ | 
|   13  |   13  | 
 |   14 #include <stddef.h> | 
 |   15 #include <stdint.h> | 
 |   16  | 
|   14 #include <string> |   17 #include <string> | 
|   15  |   18  | 
|   16 #include "base/basictypes.h" |  | 
|   17 #include "base/callback.h" |   19 #include "base/callback.h" | 
|   18 #include "base/gtest_prod_util.h" |   20 #include "base/gtest_prod_util.h" | 
 |   21 #include "base/macros.h" | 
|   19 #include "base/memory/linked_ptr.h" |   22 #include "base/memory/linked_ptr.h" | 
|   20 #include "base/memory/ref_counted.h" |   23 #include "base/memory/ref_counted.h" | 
|   21 #include "base/memory/scoped_ptr.h" |   24 #include "base/memory/scoped_ptr.h" | 
|   22 #include "base/memory/weak_ptr.h" |   25 #include "base/memory/weak_ptr.h" | 
|   23 #include "content/public/browser/browser_thread.h" |   26 #include "content/public/browser/browser_thread.h" | 
|   24 #include "net/url_request/url_fetcher_delegate.h" |   27 #include "net/url_request/url_fetcher_delegate.h" | 
|   25 #include "url/gurl.h" |   28 #include "url/gurl.h" | 
|   26  |   29  | 
|   27 namespace base { |   30 namespace base { | 
|   28 class TimeDelta; |   31 class TimeDelta; | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
|   49  |   52  | 
|   50   ModelLoader(base::Closure update_renderers, |   53   ModelLoader(base::Closure update_renderers, | 
|   51               net::URLRequestContextGetter* request_context_getter, |   54               net::URLRequestContextGetter* request_context_getter, | 
|   52               bool is_extended_reporting); |   55               bool is_extended_reporting); | 
|   53   ~ModelLoader() override; |   56   ~ModelLoader() override; | 
|   54  |   57  | 
|   55   // From the net::URLFetcherDelegate interface. |   58   // From the net::URLFetcherDelegate interface. | 
|   56   void OnURLFetchComplete(const net::URLFetcher* source) override; |   59   void OnURLFetchComplete(const net::URLFetcher* source) override; | 
|   57  |   60  | 
|   58   // Schedules the next fetch of the model. |   61   // Schedules the next fetch of the model. | 
|   59   virtual void ScheduleFetch(int64 delay_ms); |   62   virtual void ScheduleFetch(int64_t delay_ms); | 
|   60  |   63  | 
|   61   // Cancel any pending model fetch. |   64   // Cancel any pending model fetch. | 
|   62   virtual void CancelFetcher(); |   65   virtual void CancelFetcher(); | 
|   63  |   66  | 
|   64   const std::string& model_str() const { return model_str_; } |   67   const std::string& model_str() const { return model_str_; } | 
|   65   const std::string& name() const { return name_; } |   68   const std::string& name() const { return name_; } | 
|   66  |   69  | 
|   67  protected: |   70  protected: | 
|   68   // Enum used to keep stats about why we fail to get the client model. |   71   // Enum used to keep stats about why we fail to get the client model. | 
|   69   enum ClientModelStatus { |   72   enum ClientModelStatus { | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  131   FRIEND_TEST_ALL_PREFIXES(ModelLoaderTest, RescheduleFetchTest); |  134   FRIEND_TEST_ALL_PREFIXES(ModelLoaderTest, RescheduleFetchTest); | 
|  132   FRIEND_TEST_ALL_PREFIXES(ModelLoaderTest, UpdateRenderersTest); |  135   FRIEND_TEST_ALL_PREFIXES(ModelLoaderTest, UpdateRenderersTest); | 
|  133   FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, |  136   FRIEND_TEST_ALL_PREFIXES(ClientSideDetectionServiceTest, | 
|  134                            SetEnabledAndRefreshState); |  137                            SetEnabledAndRefreshState); | 
|  135   DISALLOW_COPY_AND_ASSIGN(ModelLoader); |  138   DISALLOW_COPY_AND_ASSIGN(ModelLoader); | 
|  136 }; |  139 }; | 
|  137  |  140  | 
|  138 }  // namespace safe_browsing |  141 }  // namespace safe_browsing | 
|  139  |  142  | 
|  140 #endif  // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_MODEL_LOADER_H_ |  143 #endif  // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_MODEL_LOADER_H_ | 
| OLD | NEW |