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

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

Issue 2726043003: Revert "[translate] Add translate ranker model loader." (Closed)
Patch Set: Created 3 years, 9 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 11 matching lines...) Expand all
22 class TranslateEventProto; 22 class TranslateEventProto;
23 } 23 }
24 24
25 namespace translate { 25 namespace translate {
26 26
27 extern const base::Feature kTranslateLanguageByULP; 27 extern const base::Feature kTranslateLanguageByULP;
28 28
29 class TranslateClient; 29 class TranslateClient;
30 class TranslateDriver; 30 class TranslateDriver;
31 class TranslatePrefs; 31 class TranslatePrefs;
32 class TranslateRanker;
33 32
34 namespace testing { 33 namespace testing {
35 class TranslateManagerTest; 34 class TranslateManagerTest;
36 } // namespace testing 35 } // namespace testing
37 36
38 struct TranslateErrorDetails; 37 struct TranslateErrorDetails;
39 38
40 // The TranslateManager class is responsible for showing an info-bar when a page 39 // The TranslateManager class is responsible for showing an info-bar when a page
41 // in a language different than the user language is loaded. It triggers the 40 // in a language different than the user language is loaded. It triggers the
42 // page translation the user requests. 41 // page translation the user requests.
43 42
44 class TranslateManager { 43 class TranslateManager {
45 public: 44 public:
46 // |translate_client| is expected to outlive the TranslateManager. 45 // |translate_client| is expected to outlive the TranslateManager.
47 // |accept_language_pref_name| is the path for the preference for the 46 // |accept_language_pref_name| is the path for the preference for the
48 // accept-languages. 47 // accept-languages.
49 TranslateManager(TranslateClient* translate_client, 48 TranslateManager(TranslateClient* translate_client,
50 TranslateRanker* translate_ranker,
51 const std::string& accept_language_pref_name); 49 const std::string& accept_language_pref_name);
52 virtual ~TranslateManager(); 50 virtual ~TranslateManager();
53 51
54 // Returns a weak pointer to this instance. 52 // Returns a weak pointer to this instance.
55 base::WeakPtr<TranslateManager> GetWeakPtr(); 53 base::WeakPtr<TranslateManager> GetWeakPtr();
56 54
57 // Cannot return NULL. 55 // Cannot return NULL.
58 TranslateClient* translate_client() { return translate_client_; } 56 TranslateClient* translate_client() { return translate_client_; }
59 57
60 // Sets the sequence number of the current page, for use while sending 58 // Sets the sequence number of the current page, for use while sending
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 const TranslatePrefs& translate_prefs); 154 const TranslatePrefs& translate_prefs);
157 155
158 // Sequence number of the current page. 156 // Sequence number of the current page.
159 int page_seq_no_; 157 int page_seq_no_;
160 158
161 // Preference name for the Accept-Languages HTTP header. 159 // Preference name for the Accept-Languages HTTP header.
162 std::string accept_languages_pref_name_; 160 std::string accept_languages_pref_name_;
163 161
164 TranslateClient* translate_client_; // Weak. 162 TranslateClient* translate_client_; // Weak.
165 TranslateDriver* translate_driver_; // Weak. 163 TranslateDriver* translate_driver_; // Weak.
166 TranslateRanker* translate_ranker_; // Weak.
167 164
168 LanguageState language_state_; 165 LanguageState language_state_;
169 166
170 std::unique_ptr<metrics::TranslateEventProto> translate_event_; 167 std::unique_ptr<metrics::TranslateEventProto> translate_event_;
171 168
172 base::WeakPtrFactory<TranslateManager> weak_method_factory_; 169 base::WeakPtrFactory<TranslateManager> weak_method_factory_;
173 170
174 // By default, don't offer to translate in builds lacking an API key. For 171 // By default, don't offer to translate in builds lacking an API key. For
175 // testing, set to true to offer anyway. 172 // testing, set to true to offer anyway.
176 static bool ignore_missing_key_for_testing_; 173 static bool ignore_missing_key_for_testing_;
177 174
178 DISALLOW_COPY_AND_ASSIGN(TranslateManager); 175 DISALLOW_COPY_AND_ASSIGN(TranslateManager);
179 }; 176 };
180 177
181 } // namespace translate 178 } // namespace translate
182 179
183 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ 180 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698