| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DELEGATE2_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE2_H_ |
| 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE2_H_ | 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE2_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 Type infobar_type, | 42 Type infobar_type, |
| 43 TranslateErrors::Type error, | 43 TranslateErrors::Type error, |
| 44 TabContents* tab_contents, | 44 TabContents* tab_contents, |
| 45 const std::string& original_language, | 45 const std::string& original_language, |
| 46 const std::string& target_language); | 46 const std::string& target_language); |
| 47 | 47 |
| 48 // Returns the number of languages supported. | 48 // Returns the number of languages supported. |
| 49 int GetLanguageCount() const; | 49 int GetLanguageCount() const; |
| 50 | 50 |
| 51 // Returns the ISO code for the language at |index|. | 51 // Returns the ISO code for the language at |index|. |
| 52 std::string GetLanguageCodeAt(int index) const; | 52 const std::string& GetLanguageCodeAt(int index) const; |
| 53 | 53 |
| 54 // Returns the displayable name for the language at |index|. | 54 // Returns the displayable name for the language at |index|. |
| 55 string16 GetLanguageDisplayableNameAt(int index) const; | 55 const string16& GetLanguageDisplayableNameAt(int index) const; |
| 56 | 56 |
| 57 TabContents* tab_contents() const { return tab_contents_; } | 57 TabContents* tab_contents() const { return tab_contents_; } |
| 58 | 58 |
| 59 Type type() const { return type_; } | 59 Type type() const { return type_; } |
| 60 | 60 |
| 61 int original_language_index() const { return original_language_index_; } | 61 int original_language_index() const { return original_language_index_; } |
| 62 int target_language_index() const { return target_language_index_; } | 62 int target_language_index() const { return target_language_index_; } |
| 63 | 63 |
| 64 // Convenience methods. | 64 // Convenience methods. |
| 65 std::string GetOriginalLanguageCode() const; | 65 const std::string& GetOriginalLanguageCode() const; |
| 66 std::string GetTargetLanguageCode() const; | 66 const std::string& GetTargetLanguageCode() const; |
| 67 | 67 |
| 68 // Called by the InfoBar to notify that the original/target language has | 68 // Called by the InfoBar to notify that the original/target language has |
| 69 // changed and is now the language at |language_index|. | 69 // changed and is now the language at |language_index|. |
| 70 virtual void SetOriginalLanguage(int language_index); | 70 virtual void SetOriginalLanguage(int language_index); |
| 71 virtual void SetTargetLanguage(int language_index); | 71 virtual void SetTargetLanguage(int language_index); |
| 72 | 72 |
| 73 // Returns true if the current infobar indicates an error (in which case it | 73 // Returns true if the current infobar indicates an error (in which case it |
| 74 // should get a yellow background instead of a blue one). | 74 // should get a yellow background instead of a blue one). |
| 75 bool IsError(); | 75 bool IsError(); |
| 76 | 76 |
| 77 // Returns what kind of background fading effect the infobar should use when | 77 // Returns what kind of background fading effect the infobar should use when |
| 78 // its is shown. | 78 // its is shown. |
| 79 BackgroundAnimationType background_animation_type() const { | 79 BackgroundAnimationType background_animation_type() const { |
| 80 return background_animation_; | 80 return background_animation_; |
| 81 } | 81 } |
| 82 | 82 |
| 83 virtual void Translate(); | 83 virtual void Translate(); |
| 84 virtual void RevertTranslation(); | 84 virtual void RevertTranslation(); |
| 85 | 85 |
| 86 // Called when the user declines to translate a page, by either closing the | 86 // Called when the user declines to translate a page, by either closing the |
| 87 // infobar or pressing the "Don't translate" button. | 87 // infobar or pressing the "Don't translate" button. |
| 88 void TranslationDeclined(); | 88 void TranslationDeclined(); |
| 89 | 89 |
| 90 // InfoBarDelegate implementation: | 90 // InfoBarDelegate implementation: |
| 91 virtual InfoBar* CreateInfoBar(); | 91 virtual InfoBar* CreateInfoBar(); |
| 92 virtual void InfoBarDismissed(); | 92 void InfoBarDismissed(); |
| 93 virtual void InfoBarClosed(); | |
| 94 virtual SkBitmap* GetIcon() const; | 93 virtual SkBitmap* GetIcon() const; |
| 95 virtual InfoBarDelegate::Type GetInfoBarType(); | 94 virtual InfoBarDelegate::Type GetInfoBarType(); |
| 96 virtual TranslateInfoBarDelegate2* AsTranslateInfoBarDelegate2() { | 95 virtual TranslateInfoBarDelegate2* AsTranslateInfoBarDelegate2() { |
| 97 return this; | 96 return this; |
| 98 } | 97 } |
| 99 | 98 |
| 100 // Methods called by the Options menu delegate. | 99 // Methods called by the Options menu delegate. |
| 101 virtual bool IsLanguageBlacklisted(); | 100 virtual bool IsLanguageBlacklisted(); |
| 102 virtual void ToggleLanguageBlacklist(); | 101 virtual void ToggleLanguageBlacklist(); |
| 103 virtual bool IsSiteBlacklisted(); | 102 virtual bool IsSiteBlacklisted(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 TranslateInfoBarView* infobar_view_; | 170 TranslateInfoBarView* infobar_view_; |
| 172 | 171 |
| 173 // The translation related preferences. | 172 // The translation related preferences. |
| 174 TranslatePrefs prefs_; | 173 TranslatePrefs prefs_; |
| 175 | 174 |
| 176 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate2); | 175 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate2); |
| 177 }; | 176 }; |
| 178 | 177 |
| 179 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE2_H_ | 178 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE2_H_ |
| 180 | 179 |
| OLD | NEW |