| 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_INFOBARS_DELEGATES_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBARS_DELEGATES_H_ |
| 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBARS_DELEGATES_H_ | 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBARS_DELEGATES_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/tab_contents/infobar_delegate.h" | 8 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 9 #include "chrome/browser/translate/translate_prefs.h" | 9 #include "chrome/browser/translate/translate_prefs.h" |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 const std::string& GetLocaleFromIndex(int lang_index) const { | 53 const std::string& GetLocaleFromIndex(int lang_index) const { |
| 54 return supported_languages_[lang_index]; | 54 return supported_languages_[lang_index]; |
| 55 } | 55 } |
| 56 TabContents* tab_contents() const { | 56 TabContents* tab_contents() const { |
| 57 return tab_contents_; | 57 return tab_contents_; |
| 58 } | 58 } |
| 59 TranslateState state() const { | 59 TranslateState state() const { |
| 60 return state_; | 60 return state_; |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Retrieve the text for the toolbar label. The toolbar label is a bit |
| 64 // strange since we need to place popup menus inside the string in question. |
| 65 // To do this we use two placeholders. |
| 66 // |
| 67 // |message_text| is the text to display for the label. |
| 68 // |offsets| contains the offsets of the number of placeholders in the text |
| 69 // + message_text->length() i.e. it can contain 2 or 3 elements. |
| 70 // offsets[0] < offsets[1] even in cases where the languages need to be |
| 71 // displayed in reverse order. |
| 72 // |swapped_language_placeholders| is true if we need to flip the order |
| 73 // of the menus in the current locale. |
| 74 void GetMessageText(string16 *message_text, |
| 75 std::vector<size_t> *offsets, |
| 76 bool *swapped_language_placeholders); |
| 77 |
| 63 // Overridden from InfoBarDelegate. | 78 // Overridden from InfoBarDelegate. |
| 64 virtual Type GetInfoBarType() { | 79 virtual Type GetInfoBarType() { |
| 65 return PAGE_ACTION_TYPE; | 80 return PAGE_ACTION_TYPE; |
| 66 } | 81 } |
| 67 virtual SkBitmap* GetIcon() const; | 82 virtual SkBitmap* GetIcon() const; |
| 68 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() { | 83 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() { |
| 69 return this; | 84 return this; |
| 70 } | 85 } |
| 71 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; | 86 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; |
| 72 virtual void InfoBarClosed(); | 87 virtual void InfoBarClosed(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 87 // The list of languages supported. | 102 // The list of languages supported. |
| 88 std::vector<std::string> supported_languages_; | 103 std::vector<std::string> supported_languages_; |
| 89 bool never_translate_language_; | 104 bool never_translate_language_; |
| 90 bool never_translate_site_; | 105 bool never_translate_site_; |
| 91 bool always_translate_; | 106 bool always_translate_; |
| 92 | 107 |
| 93 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); | 108 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); |
| 94 }; | 109 }; |
| 95 | 110 |
| 96 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBARS_DELEGATES_H_ | 111 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBARS_DELEGATES_H_ |
| OLD | NEW |