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_CLIENT_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_ |
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "components/translate/core/browser/translate_prefs.h" | 12 #include "components/translate/core/browser/translate_prefs.h" |
13 #include "components/translate/core/browser/translate_step.h" | 13 #include "components/translate/core/browser/translate_step.h" |
14 #include "components/translate/core/common/translate_errors.h" | 14 #include "components/translate/core/common/translate_errors.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 class PrefService; | 17 class PrefService; |
18 | 18 |
19 namespace infobars { | 19 namespace infobars { |
20 class InfoBar; | 20 class InfoBar; |
21 } | 21 } |
22 | 22 |
23 namespace metrics { | |
24 class TranslateEventProto; | |
25 } // namespace metrics | |
26 | |
23 namespace translate { | 27 namespace translate { |
24 | 28 |
25 class TranslateAcceptLanguages; | 29 class TranslateAcceptLanguages; |
26 class TranslateDriver; | 30 class TranslateDriver; |
27 class TranslateInfoBarDelegate; | 31 class TranslateInfoBarDelegate; |
28 | 32 |
29 // A client interface that needs to be supplied to TranslateManager by the | 33 // A client interface that needs to be supplied to TranslateManager by the |
30 // embedder. | 34 // embedder. |
31 // | 35 // |
32 // Each client instance is associated with a given context within which a | 36 // Each client instance is associated with a given context within which a |
(...skipping 10 matching lines...) Expand all Loading... | |
43 | 47 |
44 // Returns the associated TranslatePrefs. | 48 // Returns the associated TranslatePrefs. |
45 virtual std::unique_ptr<TranslatePrefs> GetTranslatePrefs() = 0; | 49 virtual std::unique_ptr<TranslatePrefs> GetTranslatePrefs() = 0; |
46 | 50 |
47 // Returns the associated TranslateAcceptLanguages. | 51 // Returns the associated TranslateAcceptLanguages. |
48 virtual TranslateAcceptLanguages* GetTranslateAcceptLanguages() = 0; | 52 virtual TranslateAcceptLanguages* GetTranslateAcceptLanguages() = 0; |
49 | 53 |
50 // Returns the resource ID of the icon to be shown for the Translate infobars. | 54 // Returns the resource ID of the icon to be shown for the Translate infobars. |
51 virtual int GetInfobarIconID() const = 0; | 55 virtual int GetInfobarIconID() const = 0; |
52 | 56 |
57 // Record translate event. | |
58 // This is for gaia-keyed logging. | |
amoylan
2017/05/30 03:10:56
Is 'gaia' the right terminology to use in the cont
renjieliu1
2017/05/30 03:33:24
thanks for pointing out this!
| |
59 virtual void RecordTranslateEvent(const metrics::TranslateEventProto&) = 0; | |
amoylan
2017/05/30 03:10:56
Include name of the parameter to RecordTranslateEv
renjieliu1
2017/05/30 03:33:24
Done.
| |
60 | |
53 #if !defined(USE_AURA) | 61 #if !defined(USE_AURA) |
54 // Returns a translate infobar that owns |delegate|. | 62 // Returns a translate infobar that owns |delegate|. |
55 virtual std::unique_ptr<infobars::InfoBar> CreateInfoBar( | 63 virtual std::unique_ptr<infobars::InfoBar> CreateInfoBar( |
56 std::unique_ptr<TranslateInfoBarDelegate> delegate) const = 0; | 64 std::unique_ptr<TranslateInfoBarDelegate> delegate) const = 0; |
57 #endif | 65 #endif |
58 | 66 |
59 // Called when the embedder should present UI to the user corresponding to the | 67 // Called when the embedder should present UI to the user corresponding to the |
60 // user's current |step|. | 68 // user's current |step|. |
61 virtual void ShowTranslateUI(translate::TranslateStep step, | 69 virtual void ShowTranslateUI(translate::TranslateStep step, |
62 const std::string& source_language, | 70 const std::string& source_language, |
63 const std::string& target_language, | 71 const std::string& target_language, |
64 TranslateErrors::Type error_type, | 72 TranslateErrors::Type error_type, |
65 bool triggered_from_menu) = 0; | 73 bool triggered_from_menu) = 0; |
66 | 74 |
67 // Returns true if the URL can be translated. | 75 // Returns true if the URL can be translated. |
68 virtual bool IsTranslatableURL(const GURL& url) = 0; | 76 virtual bool IsTranslatableURL(const GURL& url) = 0; |
69 | 77 |
70 // Presents |report_url|, a URL containing information relating to reporting | 78 // Presents |report_url|, a URL containing information relating to reporting |
71 // a language detection error, to the user to allow them to report language | 79 // a language detection error, to the user to allow them to report language |
72 // detection errors as desired. | 80 // detection errors as desired. |
73 virtual void ShowReportLanguageDetectionErrorUI(const GURL& report_url) = 0; | 81 virtual void ShowReportLanguageDetectionErrorUI(const GURL& report_url) = 0; |
74 }; | 82 }; |
75 | 83 |
76 } // namespace translate | 84 } // namespace translate |
77 | 85 |
78 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_ | 86 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_ |
OLD | NEW |