Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Side by Side Diff: chrome/browser/translate/translate_infobar_delegate.h

Issue 190063006: Infobar Componentization Proof of Concept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixes Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 bool triggered_from_menu() const { 99 bool triggered_from_menu() const {
100 return triggered_from_menu_; 100 return triggered_from_menu_;
101 } 101 }
102 102
103 // Returns what kind of background fading effect the infobar should use when 103 // Returns what kind of background fading effect the infobar should use when
104 // its is shown. 104 // its is shown.
105 BackgroundAnimationType background_animation_type() const { 105 BackgroundAnimationType background_animation_type() const {
106 return background_animation_; 106 return background_animation_;
107 } 107 }
108 108
109 content::WebContents* web_contents() { return web_contents_; }
110
109 virtual void Translate(); 111 virtual void Translate();
110 virtual void RevertTranslation(); 112 virtual void RevertTranslation();
111 void ReportLanguageDetectionError(); 113 void ReportLanguageDetectionError();
112 114
113 // Called when the user declines to translate a page, by either closing the 115 // Called when the user declines to translate a page, by either closing the
114 // infobar or pressing the "Don't translate" button. 116 // infobar or pressing the "Don't translate" button.
115 virtual void TranslationDeclined(); 117 virtual void TranslationDeclined();
116 118
117 // Methods called by the Options menu delegate. 119 // Methods called by the Options menu delegate.
118 virtual bool IsTranslatableLanguageByPrefs(); 120 virtual bool IsTranslatableLanguageByPrefs();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 typedef std::pair<std::string, base::string16> LanguageNamePair; 181 typedef std::pair<std::string, base::string16> LanguageNamePair;
180 182
181 // Returns a translate infobar that owns |delegate|. 183 // Returns a translate infobar that owns |delegate|.
182 static scoped_ptr<InfoBar> CreateInfoBar( 184 static scoped_ptr<InfoBar> CreateInfoBar(
183 scoped_ptr<TranslateInfoBarDelegate> delegate); 185 scoped_ptr<TranslateInfoBarDelegate> delegate);
184 186
185 // InfoBarDelegate: 187 // InfoBarDelegate:
186 virtual void InfoBarDismissed() OVERRIDE; 188 virtual void InfoBarDismissed() OVERRIDE;
187 virtual int GetIconID() const OVERRIDE; 189 virtual int GetIconID() const OVERRIDE;
188 virtual InfoBarDelegate::Type GetInfoBarType() const OVERRIDE; 190 virtual InfoBarDelegate::Type GetInfoBarType() const OVERRIDE;
189 virtual bool ShouldExpire( 191 virtual bool ShouldExpire(const NavigationDetails& details) const OVERRIDE;
190 const content::LoadCommittedDetails& details) const OVERRIDE;
191 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() OVERRIDE; 192 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() OVERRIDE;
193 virtual void CleanUp() OVERRIDE;
192 194
193 TranslateTabHelper::TranslateStep step_; 195 TranslateTabHelper::TranslateStep step_;
194 196
197 content::WebContents* web_contents_;
198
195 // The type of fading animation if any that should be used when showing this 199 // The type of fading animation if any that should be used when showing this
196 // infobar. 200 // infobar.
197 BackgroundAnimationType background_animation_; 201 BackgroundAnimationType background_animation_;
198 202
199 TranslateUIDelegate ui_delegate_; 203 TranslateUIDelegate ui_delegate_;
200 204
201 // The error that occurred when trying to translate (NONE if no error). 205 // The error that occurred when trying to translate (NONE if no error).
202 TranslateErrors::Type error_type_; 206 TranslateErrors::Type error_type_;
203 207
204 // The translation related preferences. 208 // The translation related preferences.
205 scoped_ptr<TranslatePrefs> prefs_; 209 scoped_ptr<TranslatePrefs> prefs_;
206 210
207 // Whether the translation was triggered via a menu click vs automatically 211 // Whether the translation was triggered via a menu click vs automatically
208 // (due to language detection, preferences...) 212 // (due to language detection, preferences...)
209 bool triggered_from_menu_; 213 bool triggered_from_menu_;
210 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); 214 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate);
211 }; 215 };
212 216
213 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ 217 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698