summaryrefslogtreecommitdiff
path: root/chromium/components/language/core/browser/language_model.h
blob: 86f180336ea7d946b70726e6c0936a92c362ef01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2017 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_LANGUAGE_CORE_BROWSER_LANGUAGE_MODEL_H_
#define COMPONENTS_LANGUAGE_CORE_BROWSER_LANGUAGE_MODEL_H_

#include <string>
#include <vector>

#include "components/keyed_service/core/keyed_service.h"

namespace language {

// Defines a user language model represented by a ranked list of languages and
// associated scores.
class LanguageModel {
 public:
  // Information about one language that a user understands.
  struct LanguageDetails {
    LanguageDetails();
    LanguageDetails(const std::string& in_lang_code, float in_score);

    // The language code.
    std::string lang_code;

    // A score representing the importance of the language to the user. Higher
    // scores mean that the language is of more importance to the user.
    float score;
  };

  virtual ~LanguageModel() {}

  // The set of languages that the user understands. The languages are ranked
  // from most important to least.
  virtual std::vector<LanguageDetails> GetLanguages() = 0;
};

}  // namespace language

#endif  // COMPONENTS_LANGUAGE_CORE_BROWSER_LANGUAGE_MODEL_H_