Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: components/translate/core/browser/ranker_model.h

Issue 2565873002: [translate] Add translate ranker model loader. (Closed)
Patch Set: comments from sdefresne Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/translate/core/browser/ranker_model.h
diff --git a/components/translate/core/browser/ranker_model.h b/components/translate/core/browser/ranker_model.h
new file mode 100644
index 0000000000000000000000000000000000000000..d7041de703e2ceb1f7c74079508d20ddb4717cf6
--- /dev/null
+++ b/components/translate/core/browser/ranker_model.h
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// 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_H_
+#define COMPONENTS_TRANSLATE_CORE_BROWSER_RANKER_MODEL_H_
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+
+namespace chrome_intelligence {
+
+class RankerModelProto;
+
+// Wrapper class for chrome_intelligence::TranslateRankerProto.
+class RankerModel {
+ public:
+ RankerModel();
+ ~RankerModel();
+
+ // Returns a new ranker model constructed from |data|.
+ static std::unique_ptr<RankerModel> FromString(const std::string& data);
+
+ const RankerModelProto& proto() const { return *proto_; }
+ RankerModelProto* mutable_proto() const { return proto_.get(); }
+
+ // Returns true if this ranker model has expired.
+ bool IsExpired() const;
+
+ const std::string& GetSourceURL() const;
+
+ // Returns a serialization of this ranker model.
+ std::string SerializeAsString() const;
+
+ private:
+ // The underlying ranker model proto.
+ std::unique_ptr<RankerModelProto> proto_;
+
+ DISALLOW_COPY_AND_ASSIGN(RankerModel);
+};
+
+} // namesapce chrome_intelligence
+
+#endif // COMPONENTS_TRANSLATE_CORE_BROWSER_RANKER_MODEL_H_

Powered by Google App Engine
This is Rietveld 408576698