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 } // namespace infobars |
| 22 |
| 23 namespace metrics { |
| 24 class TranslateEventProto; |
| 25 } // namespace metrics |
22 | 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 // |
(...skipping 11 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 user ID keyed event logging. |
| 59 // This function will take metrics::TranslateEventProto and log the evnet that |
| 60 // we care about. |
| 61 virtual void RecordTranslateEvent(const metrics::TranslateEventProto&) = 0; |
| 62 |
53 #if !defined(USE_AURA) | 63 #if !defined(USE_AURA) |
54 // Returns a translate infobar that owns |delegate|. | 64 // Returns a translate infobar that owns |delegate|. |
55 virtual std::unique_ptr<infobars::InfoBar> CreateInfoBar( | 65 virtual std::unique_ptr<infobars::InfoBar> CreateInfoBar( |
56 std::unique_ptr<TranslateInfoBarDelegate> delegate) const = 0; | 66 std::unique_ptr<TranslateInfoBarDelegate> delegate) const = 0; |
57 #endif | 67 #endif |
58 | 68 |
59 // Called when the embedder should present UI to the user corresponding to the | 69 // Called when the embedder should present UI to the user corresponding to the |
60 // user's current |step|. | 70 // user's current |step|. |
61 virtual void ShowTranslateUI(translate::TranslateStep step, | 71 virtual void ShowTranslateUI(translate::TranslateStep step, |
62 const std::string& source_language, | 72 const std::string& source_language, |
63 const std::string& target_language, | 73 const std::string& target_language, |
64 TranslateErrors::Type error_type, | 74 TranslateErrors::Type error_type, |
65 bool triggered_from_menu) = 0; | 75 bool triggered_from_menu) = 0; |
66 | 76 |
67 // Returns true if the URL can be translated. | 77 // Returns true if the URL can be translated. |
68 virtual bool IsTranslatableURL(const GURL& url) = 0; | 78 virtual bool IsTranslatableURL(const GURL& url) = 0; |
69 | 79 |
70 // Presents |report_url|, a URL containing information relating to reporting | 80 // Presents |report_url|, a URL containing information relating to reporting |
71 // a language detection error, to the user to allow them to report language | 81 // a language detection error, to the user to allow them to report language |
72 // detection errors as desired. | 82 // detection errors as desired. |
73 virtual void ShowReportLanguageDetectionErrorUI(const GURL& report_url) = 0; | 83 virtual void ShowReportLanguageDetectionErrorUI(const GURL& report_url) = 0; |
74 }; | 84 }; |
75 | 85 |
76 } // namespace translate | 86 } // namespace translate |
77 | 87 |
78 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_ | 88 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_ |
OLD | NEW |