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

Side by Side Diff: components/translate/core/browser/language_model.h

Issue 2649163003: [LanguageModel] Clear the model when clearing full history (Closed)
Patch Set: Martin's comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_LANGUAGE_MODEL_H_ 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_MODEL_H_
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_MODEL_H_ 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_MODEL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/time/time.h"
12 #include "components/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/keyed_service.h"
13 14
14 class PrefRegistrySimple; 15 class PrefRegistrySimple;
15 class PrefService; 16 class PrefService;
16 17
17 namespace translate { 18 namespace translate {
18 19
19 // Collects data about languages in which the user reads the web and provides 20 // Collects data about languages in which the user reads the web and provides
20 // access to current estimated language preferences. The past behaviour is 21 // access to current estimated language preferences. The past behaviour is
21 // discounted so that this model reflects changes in browsing habits. This model 22 // discounted so that this model reflects changes in browsing habits. This model
(...skipping 27 matching lines...) Expand all
49 // enough data points. 50 // enough data points.
50 std::vector<LanguageInfo> GetTopLanguages() const; 51 std::vector<LanguageInfo> GetTopLanguages() const;
51 52
52 // Returns the estimated frequency for the given language or 0 if the language 53 // Returns the estimated frequency for the given language or 0 if the language
53 // is not among the top languages kept in the model. 54 // is not among the top languages kept in the model.
54 float GetLanguageFrequency(const std::string& language_code) const; 55 float GetLanguageFrequency(const std::string& language_code) const;
55 56
56 // Informs the model that a page with the given language has been visited. 57 // Informs the model that a page with the given language has been visited.
57 void OnPageVisited(const std::string& language_code); 58 void OnPageVisited(const std::string& language_code);
58 59
60 // Reflect in the model that history from |begin| to |end| gets cleared.
61 void ClearHistory(base::Time begin, base::Time end);
groby-ooo-7-16 2017/01/25 16:12:45 Huh. I thought we had a TimeRange, but apparently
jkrcal 2017/01/26 15:46:22 Acknowledged.
62
59 private: 63 private:
60 PrefService* pref_service_; 64 PrefService* pref_service_;
61 65
62 DISALLOW_COPY_AND_ASSIGN(LanguageModel); 66 DISALLOW_COPY_AND_ASSIGN(LanguageModel);
63 }; 67 };
64 68
65 } // namespace translate 69 } // namespace translate
66 70
67 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_MODEL_H_ 71 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698