| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_DELEGATE_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_TRANSLATE_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> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "components/infobars/core/infobar_delegate.h" | 15 #include "components/infobars/core/infobar_delegate.h" |
| 16 #include "components/translate/core/browser/translate_prefs.h" | 16 #include "components/translate/core/browser/translate_prefs.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 TranslateInfoBarDelegate* old_delegate, | 182 TranslateInfoBarDelegate* old_delegate, |
| 183 const std::string& original_language, | 183 const std::string& original_language, |
| 184 const std::string& target_language, | 184 const std::string& target_language, |
| 185 TranslateErrors::Type error_type, | 185 TranslateErrors::Type error_type, |
| 186 bool triggered_from_menu); | 186 bool triggered_from_menu); |
| 187 | 187 |
| 188 private: | 188 private: |
| 189 friend class TranslationInfoBarTest; | 189 friend class TranslationInfoBarTest; |
| 190 typedef std::pair<std::string, base::string16> LanguageNamePair; | 190 typedef std::pair<std::string, base::string16> LanguageNamePair; |
| 191 | 191 |
| 192 // Returns a translate infobar that owns |delegate|. | |
| 193 static scoped_ptr<infobars::InfoBar> CreateInfoBar( | |
| 194 scoped_ptr<TranslateInfoBarDelegate> delegate); | |
| 195 | |
| 196 // Gets the TranslateClient associated with this object. | |
| 197 // May return NULL if the client has been destroyed. | |
| 198 TranslateClient* GetTranslateClient(); | |
| 199 | |
| 200 // InfoBarDelegate: | 192 // InfoBarDelegate: |
| 201 virtual void InfoBarDismissed() OVERRIDE; | 193 virtual void InfoBarDismissed() OVERRIDE; |
| 202 virtual int GetIconID() const OVERRIDE; | 194 virtual int GetIconID() const OVERRIDE; |
| 203 virtual infobars::InfoBarDelegate::Type GetInfoBarType() const OVERRIDE; | 195 virtual infobars::InfoBarDelegate::Type GetInfoBarType() const OVERRIDE; |
| 204 virtual bool ShouldExpire(const NavigationDetails& details) const OVERRIDE; | 196 virtual bool ShouldExpire(const NavigationDetails& details) const OVERRIDE; |
| 205 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() OVERRIDE; | 197 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() OVERRIDE; |
| 206 | 198 |
| 207 bool is_off_the_record_; | 199 bool is_off_the_record_; |
| 208 translate::TranslateStep step_; | 200 translate::TranslateStep step_; |
| 209 | 201 |
| 210 // The type of fading animation if any that should be used when showing this | 202 // The type of fading animation if any that should be used when showing this |
| 211 // infobar. | 203 // infobar. |
| 212 BackgroundAnimationType background_animation_; | 204 BackgroundAnimationType background_animation_; |
| 213 | 205 |
| 214 TranslateUIDelegate ui_delegate_; | 206 TranslateUIDelegate ui_delegate_; |
| 215 base::WeakPtr<TranslateManager> translate_manager_; | 207 base::WeakPtr<TranslateManager> translate_manager_; |
| 216 | 208 |
| 217 // The error that occurred when trying to translate (NONE if no error). | 209 // The error that occurred when trying to translate (NONE if no error). |
| 218 TranslateErrors::Type error_type_; | 210 TranslateErrors::Type error_type_; |
| 219 | 211 |
| 220 // The translation related preferences. | 212 // The translation related preferences. |
| 221 scoped_ptr<TranslatePrefs> prefs_; | 213 scoped_ptr<TranslatePrefs> prefs_; |
| 222 | 214 |
| 223 // Whether the translation was triggered via a menu click vs automatically | 215 // Whether the translation was triggered via a menu click vs automatically |
| 224 // (due to language detection, preferences...) | 216 // (due to language detection, preferences...) |
| 225 bool triggered_from_menu_; | 217 bool triggered_from_menu_; |
| 226 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); | 218 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); |
| 227 }; | 219 }; |
| 228 | 220 |
| 229 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ | 221 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_INFOBAR_DELEGATE_H_ |
| OLD | NEW |