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

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

Issue 2400503002: [Translate] Integrate TranslateEventProto UMA logging into TranslateManager. (Closed)
Patch Set: review candidate Created 4 years, 2 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_TRANSLATE_RANKER_H_ 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_H_
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_H_ 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 // If enabled, downloads a translate ranker model and uses it to determine 30 // If enabled, downloads a translate ranker model and uses it to determine
31 // whether the user should be given a translation prompt or not. 31 // whether the user should be given a translation prompt or not.
32 class TranslateRanker { 32 class TranslateRanker {
33 public: 33 public:
34 ~TranslateRanker(); 34 ~TranslateRanker();
35 35
36 // Returns true if query or enforcement is enabled. 36 // Returns true if query or enforcement is enabled.
37 static bool IsEnabled(); 37 static bool IsEnabled();
38 38
39 // Returns true if enforcement is enabled.
40 static bool IsQueryEnabled();
41
42 // Returns true if enforcement is enabled.
43 static bool IsEnforcementEnabled();
44
39 // Returns the singleton TranslateRanker instance. 45 // Returns the singleton TranslateRanker instance.
40 static TranslateRanker* GetInstance(); 46 static TranslateRanker* GetInstance();
41 47
42 // For testing only. Returns a TranslateRanker instance preloaded with a 48 // For testing only. Returns a TranslateRanker instance preloaded with a
43 // TranslateRankerModel as defined by |model_data|. 49 // TranslateRankerModel as defined by |model_data|.
44 static std::unique_ptr<TranslateRanker> CreateForTesting( 50 static std::unique_ptr<TranslateRanker> CreateForTesting(
45 const std::string& model_data); 51 const std::string& model_data);
46 52
47 // Initiates downloading of the assist model data. This is a NOP if the model 53 // Initiates downloading of the assist model data. This is a NOP if the model
48 // data has already been downloaded. 54 // data has already been downloaded.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 FRIEND_TEST_ALL_PREFIXES(TranslateRankerTest, CalculateScore); 100 FRIEND_TEST_ALL_PREFIXES(TranslateRankerTest, CalculateScore);
95 101
96 friend struct base::DefaultSingletonTraits<TranslateRanker>; 102 friend struct base::DefaultSingletonTraits<TranslateRanker>;
97 103
98 DISALLOW_COPY_AND_ASSIGN(TranslateRanker); 104 DISALLOW_COPY_AND_ASSIGN(TranslateRanker);
99 }; 105 };
100 106
101 } // namespace translate 107 } // namespace translate
102 108
103 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_H_ 109 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_RANKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698