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 |
11 #include "chrome/browser/tab_contents/infobar_delegate.h" | 11 #include "chrome/browser/tab_contents/infobar_delegate.h" |
12 #include "chrome/browser/translate/translate_prefs.h" | 12 #include "chrome/browser/translate/translate_prefs.h" |
13 #include "chrome/common/translate_errors.h" | 13 #include "chrome/common/translate_errors.h" |
14 | 14 |
15 class SkBitmap; | 15 class SkBitmap; |
16 class TranslateInfoBarView; | 16 class TranslateInfoBarView; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // Adds the strings that should be displayed in the after translate infobar to | 122 // Adds the strings that should be displayed in the after translate infobar to |
123 // |strings|. The text in that infobar is: | 123 // |strings|. The text in that infobar is: |
124 // "The page has been translated from <lang1> to <lang2>." | 124 // "The page has been translated from <lang1> to <lang2>." |
125 // Because <lang1> and <lang2> are displayed in menu buttons, the text is | 125 // Because <lang1> and <lang2> are displayed in menu buttons, the text is |
126 // split in 3 chunks. |swap_languages| is set to true if <lang1> and <lang2> | 126 // split in 3 chunks. |swap_languages| is set to true if <lang1> and <lang2> |
127 // should be inverted (some languages express the sentense as "The page has | 127 // should be inverted (some languages express the sentense as "The page has |
128 // been translate to <lang2> from <lang1>."). | 128 // been translate to <lang2> from <lang1>."). |
129 static void GetAfterTranslateStrings(std::vector<string16>* strings, | 129 static void GetAfterTranslateStrings(std::vector<string16>* strings, |
130 bool* swap_languages); | 130 bool* swap_languages); |
131 | 131 |
| 132 protected: |
| 133 // For testing. |
| 134 TranslateInfoBarDelegate2(Type infobar_type, |
| 135 TranslateErrors::Type error, |
| 136 TabContents* tab_contents, |
| 137 const std::string& original_language, |
| 138 const std::string& target_language); |
| 139 Type type_; |
| 140 |
132 private: | 141 private: |
133 typedef std::pair<std::string, string16> LanguageNamePair; | 142 typedef std::pair<std::string, string16> LanguageNamePair; |
134 | 143 |
135 // Gets the host of the page being translated, or an empty string if no URL is | 144 // Gets the host of the page being translated, or an empty string if no URL is |
136 // associated with the current page. | 145 // associated with the current page. |
137 std::string GetPageHost(); | 146 std::string GetPageHost(); |
138 | 147 |
139 TranslateInfoBarDelegate2(Type infobar_type, | |
140 TranslateErrors::Type error, | |
141 TabContents* tab_contents, | |
142 const std::string& original_language, | |
143 const std::string& target_language); | |
144 | |
145 Type type_; | |
146 | |
147 // The type of fading animation if any that should be used when showing this | 148 // The type of fading animation if any that should be used when showing this |
148 // infobar. | 149 // infobar. |
149 BackgroundAnimationType background_animation_; | 150 BackgroundAnimationType background_animation_; |
150 | 151 |
151 TabContents* tab_contents_; | 152 TabContents* tab_contents_; |
152 | 153 |
153 // The list supported languages for translation. | 154 // The list supported languages for translation. |
154 // The pair first string is the language ISO code (ex: en, fr...), the second | 155 // The pair first string is the language ISO code (ex: en, fr...), the second |
155 // string is the displayable name on the current locale. | 156 // string is the displayable name on the current locale. |
156 // The languages are sorted alphabetically based on the displayable name. | 157 // The languages are sorted alphabetically based on the displayable name. |
(...skipping 10 matching lines...) Expand all Loading... |
167 | 168 |
168 // The current infobar view. | 169 // The current infobar view. |
169 TranslateInfoBarView* infobar_view_; | 170 TranslateInfoBarView* infobar_view_; |
170 | 171 |
171 // The translation related preferences. | 172 // The translation related preferences. |
172 TranslatePrefs prefs_; | 173 TranslatePrefs prefs_; |
173 | 174 |
174 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate2); | 175 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate2); |
175 }; | 176 }; |
176 | 177 |
177 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE2_H | 178 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE2_H_ |
178 | 179 |
OLD | NEW |