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

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

Issue 2874393002: Automatically trigger Never-Translate in new translation infobar (Closed)
Patch Set: sync and merge Created 3 years, 7 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_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
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();
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
171 // automatically trigger "Always Translate".
172 bool ShouldAutoAlwaysTranslate();
173
174 #if defined(OS_IOS) 173 #if defined(OS_IOS)
175 // Shows the Infobar offering to never translate the language or the site. 174 // Shows the Infobar offering to never translate the language or the site.
176 void ShowNeverTranslateInfobar(); 175 void ShowNeverTranslateInfobar();
177 #endif 176 #endif
178 177
179 // Adds the strings that should be displayed in the after translate infobar to 178 // 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 179 // |strings|. If |autodetermined_source_language| is false, the text in that
181 // infobar is: 180 // infobar is:
182 // "The page has been translated from <lang1> to <lang2>." 181 // "The page has been translated from <lang1> to <lang2>."
183 // Otherwise: 182 // Otherwise:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 229
231 // The error that occurred when trying to translate (NONE if no error). 230 // The error that occurred when trying to translate (NONE if no error).
232 TranslateErrors::Type error_type_; 231 TranslateErrors::Type error_type_;
233 232
234 // The translation related preferences. 233 // The translation related preferences.
235 std::unique_ptr<TranslatePrefs> prefs_; 234 std::unique_ptr<TranslatePrefs> prefs_;
236 235
237 // Whether the translation was triggered via a menu click vs automatically 236 // Whether the translation was triggered via a menu click vs automatically
238 // (due to language detection, preferences...) 237 // (due to language detection, preferences...)
239 bool triggered_from_menu_; 238 bool triggered_from_menu_;
239
240 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); 240 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate);
241 }; 241 };
242 242
243 } // namespace translate 243 } // namespace translate
244 244
245 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ 245 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698