Chromium Code Reviews| 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_INFOBAR_DELEGATE_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ |
| 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 virtual void ToggleSiteBlacklist(); | 145 virtual void ToggleSiteBlacklist(); |
| 146 virtual bool ShouldAlwaysTranslate(); | 146 virtual bool ShouldAlwaysTranslate(); |
| 147 virtual void ToggleAlwaysTranslate(); | 147 virtual void ToggleAlwaysTranslate(); |
| 148 | 148 |
| 149 // Methods called by the extra-buttons that can appear on the "before | 149 // Methods called by the extra-buttons that can appear on the "before |
| 150 // translate" infobar (when the user has accepted/declined the translation | 150 // translate" infobar (when the user has accepted/declined the translation |
| 151 // several times). | 151 // several times). |
| 152 void AlwaysTranslatePageLanguage(); | 152 void AlwaysTranslatePageLanguage(); |
| 153 void NeverTranslatePageLanguage(); | 153 void NeverTranslatePageLanguage(); |
| 154 | 154 |
| 155 int GetTranslationAcceptedCount(); | |
|
groby-ooo-7-16
2017/05/12 17:46:45
These are both already available via TranslatePref
Marti Wong
2017/05/14 04:30:47
Sorry. These 2 lines should be removed and I forgo
| |
| 156 int GetTranslationDeniedCount(); | |
| 157 | |
| 155 // The following methods are called by the infobar that displays the status | 158 // The following methods are called by the infobar that displays the status |
| 156 // while translating and also the one displaying the error message. | 159 // while translating and also the one displaying the error message. |
| 157 base::string16 GetMessageInfoBarText(); | 160 base::string16 GetMessageInfoBarText(); |
| 158 base::string16 GetMessageInfoBarButtonText(); | 161 base::string16 GetMessageInfoBarButtonText(); |
| 159 void MessageInfoBarButtonPressed(); | 162 void MessageInfoBarButtonPressed(); |
| 160 bool ShouldShowMessageInfoBarButton(); | 163 bool ShouldShowMessageInfoBarButton(); |
| 161 | 164 |
| 162 // Called by the before translate infobar to figure-out if it should show | 165 // Called by the before translate infobar to figure-out if it should show |
| 163 // an extra shortcut to let the user black-list/white-list that language | 166 // an extra shortcut to let the user black-list/white-list that language |
| 164 // (based on how many times the user accepted/declined translation). | 167 // (based on how many times the user accepted/declined translation). |
| 165 // The shortcut itself is platform specific, it can be a button or a new bar | 168 // The shortcut itself is platform specific, it can be a button or a new bar |
| 166 // for example. | 169 // for example. |
| 167 bool ShouldShowNeverTranslateShortcut(); | 170 bool ShouldShowNeverTranslateShortcut(); |
| 168 bool ShouldShowAlwaysTranslateShortcut(); | 171 bool ShouldShowAlwaysTranslateShortcut(); |
| 169 | 172 |
| 170 // Called by translate compact infobar. This check whether we should | 173 // Called by translate compact infobar. This check whether we should |
| 171 // automatically trigger "Always Translate". | 174 // automatically trigger "Always Translate" or "Never Translate". |
| 172 bool ShouldAutoAlwaysTranslate(); | 175 bool ShouldAutoAlwaysTranslate(); |
| 176 bool ShouldAutoNeverTranslate(); | |
| 173 | 177 |
| 174 #if defined(OS_IOS) | 178 #if defined(OS_IOS) |
| 175 // Shows the Infobar offering to never translate the language or the site. | 179 // Shows the Infobar offering to never translate the language or the site. |
| 176 void ShowNeverTranslateInfobar(); | 180 void ShowNeverTranslateInfobar(); |
| 177 #endif | 181 #endif |
| 178 | 182 |
| 179 // Adds the strings that should be displayed in the after translate infobar to | 183 // Adds the strings that should be displayed in the after translate infobar to |
| 180 // |strings|. If |autodetermined_source_language| is false, the text in that | 184 // |strings|. If |autodetermined_source_language| is false, the text in that |
| 181 // infobar is: | 185 // infobar is: |
| 182 // "The page has been translated from <lang1> to <lang2>." | 186 // "The page has been translated from <lang1> to <lang2>." |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 | 234 |
| 231 // The error that occurred when trying to translate (NONE if no error). | 235 // The error that occurred when trying to translate (NONE if no error). |
| 232 TranslateErrors::Type error_type_; | 236 TranslateErrors::Type error_type_; |
| 233 | 237 |
| 234 // The translation related preferences. | 238 // The translation related preferences. |
| 235 std::unique_ptr<TranslatePrefs> prefs_; | 239 std::unique_ptr<TranslatePrefs> prefs_; |
| 236 | 240 |
| 237 // Whether the translation was triggered via a menu click vs automatically | 241 // Whether the translation was triggered via a menu click vs automatically |
| 238 // (due to language detection, preferences...) | 242 // (due to language detection, preferences...) |
| 239 bool triggered_from_menu_; | 243 bool triggered_from_menu_; |
| 244 | |
| 240 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); | 245 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); |
| 241 }; | 246 }; |
| 242 | 247 |
| 243 } // namespace translate | 248 } // namespace translate |
| 244 | 249 |
| 245 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ | 250 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ |
| OLD | NEW |