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

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

Issue 2697703004: Allow TranslateRanker to override decisions taken by heuristics. (Closed)
Patch Set: Make TranslateAcceptLanguages default constructor protected. Created 3 years, 8 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 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 // Record an event of the given |event_type| using the currently saved 118 // Record an event of the given |event_type| using the currently saved
119 // |translate_event_| as context. |event_type| must be one of the values 119 // |translate_event_| as context. |event_type| must be one of the values
120 // defined by metrics::TranslateEventProto::EventType. 120 // defined by metrics::TranslateEventProto::EventType.
121 void RecordTranslateEvent(int event_type); 121 void RecordTranslateEvent(int event_type);
122 122
123 // By default, don't offer to translate in builds lacking an API key. For 123 // By default, don't offer to translate in builds lacking an API key. For
124 // testing, set to true to offer anyway. 124 // testing, set to true to offer anyway.
125 static void SetIgnoreMissingKeyForTesting(bool ignore); 125 static void SetIgnoreMissingKeyForTesting(bool ignore);
126 126
127 // Returns true if the decision should be overridden and logs the event
128 // appropriately. |event_type| must be one of the
129 // values defined by metrics::TranslateEventProto::EventType.
130 bool ShouldOverrideDecision(int event_type);
131
127 private: 132 private:
128 friend class translate::testing::TranslateManagerTest; 133 friend class translate::testing::TranslateManagerTest;
129 134
130 // Sends a translation request to the TranslateDriver. 135 // Sends a translation request to the TranslateDriver.
131 void DoTranslatePage(const std::string& translate_script, 136 void DoTranslatePage(const std::string& translate_script,
132 const std::string& source_lang, 137 const std::string& source_lang,
133 const std::string& target_lang); 138 const std::string& target_lang);
134 139
135 // Returns the language to translate to by looking at ULP. Return empty string 140 // Returns the language to translate to by looking at ULP. Return empty string
136 // If it cannot conclude from ULP. 141 // If it cannot conclude from ULP.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // By default, don't offer to translate in builds lacking an API key. For 179 // By default, don't offer to translate in builds lacking an API key. For
175 // testing, set to true to offer anyway. 180 // testing, set to true to offer anyway.
176 static bool ignore_missing_key_for_testing_; 181 static bool ignore_missing_key_for_testing_;
177 182
178 DISALLOW_COPY_AND_ASSIGN(TranslateManager); 183 DISALLOW_COPY_AND_ASSIGN(TranslateManager);
179 }; 184 };
180 185
181 } // namespace translate 186 } // namespace translate
182 187
183 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ 188 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698