Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_RANKER_MODEL_H_ | 5 #ifndef COMPONENTS_MACHINE_INTELLIGENCE_RANKER_MODEL_H_ |
| 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_RANKER_MODEL_H_ | 6 #define COMPONENTS_MACHINE_INTELLIGENCE_RANKER_MODEL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 | 12 |
| 13 namespace chrome_intelligence { | 13 namespace machine_intelligence { |
| 14 | 14 |
| 15 class RankerModelProto; | 15 class RankerModelProto; |
| 16 | 16 |
| 17 // Wrapper class for chrome_intelligence::TranslateRankerProto. | |
| 18 class RankerModel { | 17 class RankerModel { |
| 19 public: | 18 public: |
| 20 RankerModel(); | 19 RankerModel(); |
| 21 ~RankerModel(); | 20 ~RankerModel(); |
| 22 | 21 |
| 23 // Returns a new ranker model constructed from |data|. | 22 // Returns a new ranker model constructed from |data|. |
| 24 static std::unique_ptr<RankerModel> FromString(const std::string& data); | 23 static std::unique_ptr<RankerModel> FromString(const std::string& data); |
| 25 | 24 |
| 26 const RankerModelProto& proto() const { return *proto_; } | 25 const RankerModelProto& proto() const { return *proto_; } |
| 27 RankerModelProto* mutable_proto() const { return proto_.get(); } | 26 RankerModelProto* mutable_proto() const { return proto_.get(); } |
| 28 | 27 |
| 29 // Returns true if this ranker model has expired. | 28 // Returns true if this ranker model has expired. |
| 30 bool IsExpired() const; | 29 bool IsExpired() const; |
| 31 | 30 |
| 32 const std::string& GetSourceURL() const; | 31 const std::string& GetSourceURL() const; |
| 33 | 32 |
| 34 // Returns a serialization of this ranker model. | 33 // Returns a serialization of this ranker model. |
| 35 std::string SerializeAsString() const; | 34 std::string SerializeAsString() const; |
| 36 | 35 |
| 37 private: | 36 private: |
| 38 // The underlying ranker model proto. | 37 // The underlying ranker model proto. |
| 39 std::unique_ptr<RankerModelProto> proto_; | 38 std::unique_ptr<RankerModelProto> proto_; |
| 40 | 39 |
| 41 DISALLOW_COPY_AND_ASSIGN(RankerModel); | 40 DISALLOW_COPY_AND_ASSIGN(RankerModel); |
| 42 }; | 41 }; |
| 43 | 42 |
| 44 } // namesapce chrome_intelligence | 43 } // namesapce ranker |
|
sdefresne
2017/06/23 16:18:44
namesapce → namespace
ranker → machine_intelligenc
hamelphi
2017/06/27 18:15:09
Done.
| |
| 45 | 44 |
| 46 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_RANKER_MODEL_H_ | 45 #endif // COMPONENTS_RANKERRANKER_MODEL_H_ |
|
sdefresne
2017/06/23 16:18:44
COMPONENTS_RANKERRANKER_MODEL_H_ → COMPONENTS_MACH
hamelphi
2017/06/27 18:15:09
Done.
| |
| OLD | NEW |