| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Sets this infobar background animation based on the previous infobar shown. | 161 // Sets this infobar background animation based on the previous infobar shown. |
| 162 // A fading background effect is used when transitioning from a normal state | 162 // A fading background effect is used when transitioning from a normal state |
| 163 // to an error state (and vice-versa). | 163 // to an error state (and vice-versa). |
| 164 void UpdateBackgroundAnimation(TranslateInfoBarDelegate* previous_infobar); | 164 void UpdateBackgroundAnimation(TranslateInfoBarDelegate* previous_infobar); |
| 165 | 165 |
| 166 // Convenience method that returns the displayable language name for | 166 // Convenience method that returns the displayable language name for |
| 167 // |language_code| in the current application locale. | 167 // |language_code| in the current application locale. |
| 168 static string16 GetLanguageDisplayableName(const std::string& language_code); | 168 static string16 GetLanguageDisplayableName(const std::string& language_code); |
| 169 | 169 |
| 170 // Adds the strings that should be displayed in the after translate infobar to | 170 // Adds the strings that should be displayed in the after translate infobar to |
| 171 // |strings|. The text in that infobar is: | 171 // |strings|. If |autodetermined_source_language| is false, the text in that |
| 172 // infobar is: |
| 172 // "The page has been translated from <lang1> to <lang2>." | 173 // "The page has been translated from <lang1> to <lang2>." |
| 173 // Because <lang1> and <lang2> are displayed in menu buttons, the text is | 174 // Otherwise: |
| 174 // split in 3 chunks. |swap_languages| is set to true if <lang1> and <lang2> | 175 // "The page has been translated to <lang1>." |
| 176 // Because <lang1>, or <lang1> and <lang2> are displayed in menu buttons, the |
| 177 // text is split in 2 or 3 chunks. |swap_languages| is set to true if |
| 178 // |autodetermined_source_language| is false, and <lang1> and <lang2> |
| 175 // should be inverted (some languages express the sentense as "The page has | 179 // should be inverted (some languages express the sentense as "The page has |
| 176 // been translate to <lang2> from <lang1>."). | 180 // been translate to <lang2> from <lang1>."). It is ignored if |
| 181 // |autodetermined_source_language| is true. |
| 177 static void GetAfterTranslateStrings(std::vector<string16>* strings, | 182 static void GetAfterTranslateStrings(std::vector<string16>* strings, |
| 178 bool* swap_languages); | 183 bool* swap_languages, |
| 179 | 184 bool autodetermined_source_language); |
| 180 // Adds the strings that should be displayed in the after translate infobar to | |
| 181 // |strings|. When a source language is not determined by Chrome, Languages | |
| 182 // are detected by a server automatically. And infobar doesn't show source | |
| 183 // languages. The text in the infobar is: | |
| 184 // "The page has been translated to <lang1>." | |
| 185 // Because <lang1> is displayed in a menu button, the text is split in 2 | |
| 186 // chunks. | |
| 187 static void GetAfterTranslateWithAutoStrings(std::vector<string16>* strings); | |
| 188 | 185 |
| 189 protected: | 186 protected: |
| 190 // For testing. | 187 // For testing. |
| 191 TranslateInfoBarDelegate(Type infobar_type, | 188 TranslateInfoBarDelegate(Type infobar_type, |
| 192 TranslateErrors::Type error_type, | 189 TranslateErrors::Type error_type, |
| 193 InfoBarService* infobar_service, | 190 InfoBarService* infobar_service, |
| 194 PrefService* prefs, | 191 PrefService* prefs, |
| 195 ShortcutConfiguration shortcut_config, | 192 ShortcutConfiguration shortcut_config, |
| 196 const std::string& original_language, | 193 const std::string& original_language, |
| 197 const std::string& target_language); | 194 const std::string& target_language); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 238 |
| 242 // The translation related preferences. | 239 // The translation related preferences. |
| 243 TranslatePrefs prefs_; | 240 TranslatePrefs prefs_; |
| 244 | 241 |
| 245 // Translation shortcut configuration | 242 // Translation shortcut configuration |
| 246 ShortcutConfiguration shortcut_config_; | 243 ShortcutConfiguration shortcut_config_; |
| 247 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); | 244 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); |
| 248 }; | 245 }; |
| 249 | 246 |
| 250 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ | 247 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ |
| OLD | NEW |