Index: components/ranker/ranker_model_loader.h |
diff --git a/components/translate/core/browser/ranker_model_loader.h b/components/ranker/ranker_model_loader.h |
similarity index 86% |
rename from components/translate/core/browser/ranker_model_loader.h |
rename to components/ranker/ranker_model_loader.h |
index 68445b74ecd8a13547d1a324f60409e44385bbe9..484662918ead1f8120e36b503a41e4d33bfb6e5a 100644 |
--- a/components/translate/core/browser/ranker_model_loader.h |
+++ b/components/ranker/ranker_model_loader.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_RANKER_MODEL_LOADER_H_ |
-#define COMPONENTS_TRANSLATE_CORE_BROWSER_RANKER_MODEL_LOADER_H_ |
+#ifndef COMPONENTS_RANKER_RANKER_MODEL_LOADER_H_ |
+#define COMPONENTS_RANKER_RANKER_MODEL_LOADER_H_ |
#include <memory> |
#include <string> |
@@ -20,13 +20,10 @@ namespace base { |
class SequencedTaskRunner; |
} // namespace base |
-namespace chrome_intelligence { |
-class RankerModel; |
-} // namespace chrome_intelligence |
- |
-namespace translate { |
+namespace ranker { |
-class TranslateURLFetcher; |
+class RankerURLFetcher; |
+class RankerModel; |
// Enumeration denoting the outcome of an attempt to download the model. This |
// must be kept in sync with the RankerModelStatus enum in histograms.xml |
@@ -44,22 +41,23 @@ enum class RankerModelStatus { |
MAX |
}; |
-// If enabled, downloads a translate ranker model and uses it to determine |
-// whether the user should be given a translation prompt or not. |
+// FIXME update comments. |
+ |
+// If enabled, downloads a ranker model. |
class RankerModelLoader { |
public: |
// Callback to validate a ranker model on behalf of the model loader client. |
// For example, the callback might validate that the model is compatible with |
// the features generated when ranking translation offerings. This will be |
// called on the sequence on which the model loader was constructed. |
- using ValidateModelCallback = base::RepeatingCallback<RankerModelStatus( |
- const chrome_intelligence::RankerModel&)>; |
+ using ValidateModelCallback = |
+ base::RepeatingCallback<RankerModelStatus(const ranker::RankerModel&)>; |
// Called to transfer ownership of a loaded model back to the model loader |
// client. This will be called on the sequence on which the model loader was |
// constructed. |
- using OnModelAvailableCallback = base::RepeatingCallback<void( |
- std::unique_ptr<chrome_intelligence::RankerModel>)>; |
+ using OnModelAvailableCallback = |
+ base::RepeatingCallback<void(std::unique_ptr<ranker::RankerModel>)>; |
// |validate_model_callback| may be called on any sequence; it must be thread |
// safe. |
@@ -130,15 +128,14 @@ class RankerModelLoader { |
// Called when |url_fetcher_| has finished loading |data| from |model_url_|. |
// |
- // This call signature is mandated by TranslateURLFetcher. |
+ // This call signature is mandated by RankerURLFetcher. |
// |
- // id - the id given to the TranslateURLFetcher on creation |
// success - true of the download was successful |
// data - the body of the downloads response |
- void OnURLFetched(int id, bool success, const std::string& data); |
+ void OnURLFetched(bool success, const std::string& data); |
// Parse |data| and return a validated model. Returns nullptr on failure. |
- std::unique_ptr<chrome_intelligence::RankerModel> CreateAndValidateModel( |
+ std::unique_ptr<ranker::RankerModel> CreateAndValidateModel( |
const std::string& data); |
// Helper function to log |model_status| to UMA and return it. |
@@ -171,7 +168,7 @@ class RankerModelLoader { |
const std::string uma_prefix_; |
// Used to download model data from |model_url_|. |
- std::unique_ptr<TranslateURLFetcher> url_fetcher_; |
+ std::unique_ptr<RankerURLFetcher> url_fetcher_; |
// The next time before which no new attempts to download the model should be |
// attempted. |
@@ -190,6 +187,6 @@ class RankerModelLoader { |
DISALLOW_COPY_AND_ASSIGN(RankerModelLoader); |
}; |
-} // namespace translate |
+} // namespace ranker |
-#endif // COMPONENTS_TRANSLATE_CORE_BROWSER_RANKER_MODEL_LOADER_H_ |
+#endif // COMPONENTS_RANKER_RANKER_MODEL_LOADER_H_ |