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 #include "components/translate/core/browser/ranker_model.h" | 5 #include "components/machine_intelligence/ranker_model.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "components/translate/core/browser/proto/ranker_model.pb.h" | 9 #include "components/machine_intelligence/proto/ranker_model.pb.h" |
10 | 10 |
11 namespace chrome_intelligence { | 11 namespace machine_intelligence { |
12 | 12 |
13 RankerModel::RankerModel() : proto_(base::MakeUnique<RankerModelProto>()) {} | 13 RankerModel::RankerModel() : proto_(base::MakeUnique<RankerModelProto>()) {} |
14 | 14 |
15 RankerModel::~RankerModel() {} | 15 RankerModel::~RankerModel() {} |
16 | 16 |
17 // static | 17 // static |
18 std::unique_ptr<RankerModel> RankerModel::FromString(const std::string& data) { | 18 std::unique_ptr<RankerModel> RankerModel::FromString(const std::string& data) { |
19 auto model = base::MakeUnique<RankerModel>(); | 19 auto model = base::MakeUnique<RankerModel>(); |
20 if (!model->mutable_proto()->ParseFromString(data)) | 20 if (!model->mutable_proto()->ParseFromString(data)) |
21 return nullptr; | 21 return nullptr; |
(...skipping 22 matching lines...) Expand all Loading... |
44 } | 44 } |
45 | 45 |
46 const std::string& RankerModel::GetSourceURL() const { | 46 const std::string& RankerModel::GetSourceURL() const { |
47 return proto_->metadata().source(); | 47 return proto_->metadata().source(); |
48 } | 48 } |
49 | 49 |
50 std::string RankerModel::SerializeAsString() const { | 50 std::string RankerModel::SerializeAsString() const { |
51 return proto_->SerializeAsString(); | 51 return proto_->SerializeAsString(); |
52 } | 52 } |
53 | 53 |
54 } // namespace chrome_intelligence | 54 } // namespace machine_intelligence |
OLD | NEW |