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