OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MANAGER_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ |
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 RegisterTranslateErrorCallback(const TranslateErrorCallback& callback); | 111 RegisterTranslateErrorCallback(const TranslateErrorCallback& callback); |
112 | 112 |
113 // Gets the LanguageState associated with the TranslateManager | 113 // Gets the LanguageState associated with the TranslateManager |
114 LanguageState& GetLanguageState(); | 114 LanguageState& GetLanguageState(); |
115 | 115 |
116 // Record an event of the given |event_type| using the currently saved | 116 // Record an event of the given |event_type| using the currently saved |
117 // |translate_event_| as context. |event_type| must be one of the values | 117 // |translate_event_| as context. |event_type| must be one of the values |
118 // defined by metrics::TranslateEventProto::EventType. | 118 // defined by metrics::TranslateEventProto::EventType. |
119 void RecordTranslateEvent(int event_type); | 119 void RecordTranslateEvent(int event_type); |
120 | 120 |
| 121 // Record a decision of the given |event_type| that has been |
| 122 // overriden by translate ranker using the currently saved |
| 123 // |translate_event_| as context. |event_type| must be one of the |
| 124 // values defined by metrics::TranslateEventProto::EventType. |
| 125 void RecordDecisionOverride(int event_type); |
| 126 |
121 // By default, don't offer to translate in builds lacking an API key. For | 127 // By default, don't offer to translate in builds lacking an API key. For |
122 // testing, set to true to offer anyway. | 128 // testing, set to true to offer anyway. |
123 static void SetIgnoreMissingKeyForTesting(bool ignore); | 129 static void SetIgnoreMissingKeyForTesting(bool ignore); |
124 | 130 |
125 private: | 131 private: |
126 friend class translate::testing::TranslateManagerTest; | 132 friend class translate::testing::TranslateManagerTest; |
127 | 133 |
128 // Sends a translation request to the TranslateDriver. | 134 // Sends a translation request to the TranslateDriver. |
129 void DoTranslatePage(const std::string& translate_script, | 135 void DoTranslatePage(const std::string& translate_script, |
130 const std::string& source_lang, | 136 const std::string& source_lang, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // By default, don't offer to translate in builds lacking an API key. For | 177 // By default, don't offer to translate in builds lacking an API key. For |
172 // testing, set to true to offer anyway. | 178 // testing, set to true to offer anyway. |
173 static bool ignore_missing_key_for_testing_; | 179 static bool ignore_missing_key_for_testing_; |
174 | 180 |
175 DISALLOW_COPY_AND_ASSIGN(TranslateManager); | 181 DISALLOW_COPY_AND_ASSIGN(TranslateManager); |
176 }; | 182 }; |
177 | 183 |
178 } // namespace translate | 184 } // namespace translate |
179 | 185 |
180 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ | 186 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ |
OLD | NEW |