| 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 <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 public: | 33 public: |
| 34 // The types of background color animations. | 34 // The types of background color animations. |
| 35 enum BackgroundAnimationType { | 35 enum BackgroundAnimationType { |
| 36 NONE, | 36 NONE, |
| 37 NORMAL_TO_ERROR, | 37 NORMAL_TO_ERROR, |
| 38 ERROR_TO_NORMAL | 38 ERROR_TO_NORMAL |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 static const size_t kNoIndex; | 41 static const size_t kNoIndex; |
| 42 | 42 |
| 43 virtual ~TranslateInfoBarDelegate(); | 43 ~TranslateInfoBarDelegate() override; |
| 44 | 44 |
| 45 // Factory method to create a translate infobar. |error_type| must be | 45 // Factory method to create a translate infobar. |error_type| must be |
| 46 // specified iff |step| == TRANSLATION_ERROR. For other translate steps, | 46 // specified iff |step| == TRANSLATION_ERROR. For other translate steps, |
| 47 // |original_language| and |target_language| must be ASCII language codes | 47 // |original_language| and |target_language| must be ASCII language codes |
| 48 // (e.g. "en", "fr", etc.) for languages the TranslateManager supports | 48 // (e.g. "en", "fr", etc.) for languages the TranslateManager supports |
| 49 // translating. The lone exception is when the user initiates translation | 49 // translating. The lone exception is when the user initiates translation |
| 50 // from the context menu, in which case it's legal to call this with | 50 // from the context menu, in which case it's legal to call this with |
| 51 // |step| == TRANSLATING and |original_language| == kUnknownLanguageCode. | 51 // |step| == TRANSLATING and |original_language| == kUnknownLanguageCode. |
| 52 // | 52 // |
| 53 // If |replace_existing_infobar| is true, the infobar is created and added to | 53 // If |replace_existing_infobar| is true, the infobar is created and added to |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 const std::string& original_language, | 185 const std::string& original_language, |
| 186 const std::string& target_language, | 186 const std::string& target_language, |
| 187 TranslateErrors::Type error_type, | 187 TranslateErrors::Type error_type, |
| 188 bool triggered_from_menu); | 188 bool triggered_from_menu); |
| 189 | 189 |
| 190 private: | 190 private: |
| 191 friend class TranslationInfoBarTest; | 191 friend class TranslationInfoBarTest; |
| 192 typedef std::pair<std::string, base::string16> LanguageNamePair; | 192 typedef std::pair<std::string, base::string16> LanguageNamePair; |
| 193 | 193 |
| 194 // InfoBarDelegate: | 194 // InfoBarDelegate: |
| 195 virtual void InfoBarDismissed() override; | 195 void InfoBarDismissed() override; |
| 196 virtual int GetIconID() const override; | 196 int GetIconID() const override; |
| 197 virtual infobars::InfoBarDelegate::Type GetInfoBarType() const override; | 197 infobars::InfoBarDelegate::Type GetInfoBarType() const override; |
| 198 virtual bool ShouldExpire(const NavigationDetails& details) const override; | 198 bool ShouldExpire(const NavigationDetails& details) const override; |
| 199 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() override; | 199 TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() override; |
| 200 | 200 |
| 201 bool is_off_the_record_; | 201 bool is_off_the_record_; |
| 202 translate::TranslateStep step_; | 202 translate::TranslateStep step_; |
| 203 | 203 |
| 204 // The type of fading animation if any that should be used when showing this | 204 // The type of fading animation if any that should be used when showing this |
| 205 // infobar. | 205 // infobar. |
| 206 BackgroundAnimationType background_animation_; | 206 BackgroundAnimationType background_animation_; |
| 207 | 207 |
| 208 TranslateUIDelegate ui_delegate_; | 208 TranslateUIDelegate ui_delegate_; |
| 209 base::WeakPtr<TranslateManager> translate_manager_; | 209 base::WeakPtr<TranslateManager> translate_manager_; |
| 210 | 210 |
| 211 // The error that occurred when trying to translate (NONE if no error). | 211 // The error that occurred when trying to translate (NONE if no error). |
| 212 TranslateErrors::Type error_type_; | 212 TranslateErrors::Type error_type_; |
| 213 | 213 |
| 214 // The translation related preferences. | 214 // The translation related preferences. |
| 215 scoped_ptr<TranslatePrefs> prefs_; | 215 scoped_ptr<TranslatePrefs> prefs_; |
| 216 | 216 |
| 217 // Whether the translation was triggered via a menu click vs automatically | 217 // Whether the translation was triggered via a menu click vs automatically |
| 218 // (due to language detection, preferences...) | 218 // (due to language detection, preferences...) |
| 219 bool triggered_from_menu_; | 219 bool triggered_from_menu_; |
| 220 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); | 220 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); |
| 221 }; | 221 }; |
| 222 | 222 |
| 223 } // namespace translate | 223 } // namespace translate |
| 224 | 224 |
| 225 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ | 225 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ |
| OLD | NEW |