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

Side by Side Diff: components/translate/ios/browser/language_detection_controller.h

Issue 2913573002: Updates language model on iOS. (Closed)
Patch Set: Created 3 years, 6 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_IOS_BROWSER_LANGUAGE_DETECTION_CONTROLLER_H_ 5 #ifndef COMPONENTS_TRANSLATE_IOS_BROWSER_LANGUAGE_DETECTION_CONTROLLER_H_
6 #define COMPONENTS_TRANSLATE_IOS_BROWSER_LANGUAGE_DETECTION_CONTROLLER_H_ 6 #define COMPONENTS_TRANSLATE_IOS_BROWSER_LANGUAGE_DETECTION_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 16 matching lines...) Expand all
27 namespace web { 27 namespace web {
28 class NavigationContext; 28 class NavigationContext;
29 class WebState; 29 class WebState;
30 } 30 }
31 31
32 namespace translate { 32 namespace translate {
33 33
34 class LanguageDetectionController : public web::WebStateObserver { 34 class LanguageDetectionController : public web::WebStateObserver {
35 public: 35 public:
36 // Language detection details, passed to language detection callbacks. 36 // Language detection details, passed to language detection callbacks.
37 struct DetectionDetails { 37 struct DetectionDetails {
martis 2017/06/01 06:49:21 Did you investigate reusing LanguageDetectionDetai
ramyasharma 2017/06/02 07:20:24 Yes, I did some basic investigation, and it looked
38 DetectionDetails();
39 DetectionDetails(const DetectionDetails& other);
40 ~DetectionDetails();
41
38 // The language detected by the content (Content-Language). 42 // The language detected by the content (Content-Language).
39 std::string content_language; 43 std::string content_language;
40 44
41 // The language written in the lang attribute of the html element. 45 // The language written in the lang attribute of the html element.
42 std::string html_root_language; 46 std::string html_root_language;
43 47
44 // The adopted language. 48 // The adopted language.
45 std::string adopted_language; 49 std::string adopted_language;
50
51 // The language detected by CLD.
52 std::string cld_language;
53
54 // Whether the CLD detection is reliable or not.
55 bool is_cld_reliable;
46 }; 56 };
47 57
48 LanguageDetectionController(web::WebState* web_state, 58 LanguageDetectionController(web::WebState* web_state,
49 JsLanguageDetectionManager* manager, 59 JsLanguageDetectionManager* manager,
50 PrefService* prefs); 60 PrefService* prefs);
51 ~LanguageDetectionController() override; 61 ~LanguageDetectionController() override;
52 62
53 // Callback types for language detection events. 63 // Callback types for language detection events.
54 typedef base::Callback<void(const DetectionDetails&)> Callback; 64 typedef base::Callback<void(const DetectionDetails&)> Callback;
55 typedef base::CallbackList<void(const DetectionDetails&)> CallbackList; 65 typedef base::CallbackList<void(const DetectionDetails&)> CallbackList;
(...skipping 30 matching lines...) Expand all
86 JsLanguageDetectionManager* js_manager_; 96 JsLanguageDetectionManager* js_manager_;
87 BooleanPrefMember translate_enabled_; 97 BooleanPrefMember translate_enabled_;
88 base::WeakPtrFactory<LanguageDetectionController> weak_method_factory_; 98 base::WeakPtrFactory<LanguageDetectionController> weak_method_factory_;
89 99
90 DISALLOW_COPY_AND_ASSIGN(LanguageDetectionController); 100 DISALLOW_COPY_AND_ASSIGN(LanguageDetectionController);
91 }; 101 };
92 102
93 } // namespace translate 103 } // namespace translate
94 104
95 #endif // COMPONENTS_TRANSLATE_IOS_BROWSER_LANGUAGE_DETECTION_CONTROLLER_H_ 105 #endif // COMPONENTS_TRANSLATE_IOS_BROWSER_LANGUAGE_DETECTION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698