| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 static void Create(bool replace_existing_infobar, | 69 static void Create(bool replace_existing_infobar, |
| 70 const base::WeakPtr<TranslateManager>& translate_manager, | 70 const base::WeakPtr<TranslateManager>& translate_manager, |
| 71 infobars::InfoBarManager* infobar_manager, | 71 infobars::InfoBarManager* infobar_manager, |
| 72 bool is_off_the_record, | 72 bool is_off_the_record, |
| 73 translate::TranslateStep step, | 73 translate::TranslateStep step, |
| 74 const std::string& original_language, | 74 const std::string& original_language, |
| 75 const std::string& target_language, | 75 const std::string& target_language, |
| 76 TranslateErrors::Type error_type, | 76 TranslateErrors::Type error_type, |
| 77 bool triggered_from_menu); | 77 bool triggered_from_menu); |
| 78 | 78 |
| 79 // Returns true if compact translate UI is enabled. | |
| 80 static bool IsCompactUIEnabled(); | |
| 81 | |
| 82 // Returns the number of languages supported. | 79 // Returns the number of languages supported. |
| 83 size_t num_languages() const { return ui_delegate_.GetNumberOfLanguages(); } | 80 size_t num_languages() const { return ui_delegate_.GetNumberOfLanguages(); } |
| 84 | 81 |
| 85 // Returns the ISO code for the language at |index|. | 82 // Returns the ISO code for the language at |index|. |
| 86 std::string language_code_at(size_t index) const { | 83 std::string language_code_at(size_t index) const { |
| 87 return ui_delegate_.GetLanguageCodeAt(index); | 84 return ui_delegate_.GetLanguageCodeAt(index); |
| 88 } | 85 } |
| 89 | 86 |
| 90 // Returns the displayable name for the language at |index|. | 87 // Returns the displayable name for the language at |index|. |
| 91 base::string16 language_name_at(size_t index) const { | 88 base::string16 language_name_at(size_t index) const { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 122 } |
| 126 | 123 |
| 127 // Return true if the translation was triggered by a menu entry instead of | 124 // Return true if the translation was triggered by a menu entry instead of |
| 128 // via an infobar/bubble or preference. | 125 // via an infobar/bubble or preference. |
| 129 bool triggered_from_menu() const { | 126 bool triggered_from_menu() const { |
| 130 return triggered_from_menu_; | 127 return triggered_from_menu_; |
| 131 } | 128 } |
| 132 | 129 |
| 133 virtual void Translate(); | 130 virtual void Translate(); |
| 134 virtual void RevertTranslation(); | 131 virtual void RevertTranslation(); |
| 132 void RevertWithoutClosingInfobar(); |
| 135 void ReportLanguageDetectionError(); | 133 void ReportLanguageDetectionError(); |
| 136 | 134 |
| 137 // Called when the user declines to translate a page, by either closing the | 135 // Called when the user declines to translate a page, by either closing the |
| 138 // infobar or pressing the "Don't translate" button. | 136 // infobar or pressing the "Don't translate" button. |
| 139 virtual void TranslationDeclined(); | 137 virtual void TranslationDeclined(); |
| 140 | 138 |
| 141 // Methods called by the Options menu delegate. | 139 // Methods called by the Options menu delegate. |
| 142 virtual bool IsTranslatableLanguageByPrefs(); | 140 virtual bool IsTranslatableLanguageByPrefs(); |
| 143 virtual void ToggleTranslatableLanguageByPrefs(); | 141 virtual void ToggleTranslatableLanguageByPrefs(); |
| 144 virtual bool IsSiteBlacklisted(); | 142 virtual bool IsSiteBlacklisted(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // A observer to handle front-end changes on different steps. | 236 // A observer to handle front-end changes on different steps. |
| 239 // It's only used when we try to reuse the existing UI. | 237 // It's only used when we try to reuse the existing UI. |
| 240 Observer* observer_; | 238 Observer* observer_; |
| 241 | 239 |
| 242 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); | 240 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); |
| 243 }; | 241 }; |
| 244 | 242 |
| 245 } // namespace translate | 243 } // namespace translate |
| 246 | 244 |
| 247 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ | 245 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ |
| OLD | NEW |