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

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

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years 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 | Annotate | Revision Log
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>
11 11
12 #include "base/compiler_specific.h"
13 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/infobars/infobar_delegate.h" 14 #include "chrome/browser/infobars/infobar_delegate.h"
15 #include "chrome/browser/translate/translate_prefs.h" 15 #include "chrome/browser/translate/translate_prefs.h"
16 #include "chrome/common/translate/translate_errors.h" 16 #include "chrome/common/translate/translate_errors.h"
17 #include "components/translate/common/translate_constants.h" 17 #include "components/translate/common/translate_constants.h"
18 18
19 class PrefService; 19 class PrefService;
20 20
21 // The defaults after which extra shortcuts for options 21 // The defaults after which extra shortcuts for options
22 // can be shown. 22 // can be shown.
23 struct ShortcutConfiguration { 23 struct ShortcutConfiguration {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // text is split in 2 or 3 chunks. |swap_languages| is set to true if 173 // text is split in 2 or 3 chunks. |swap_languages| is set to true if
174 // |autodetermined_source_language| is false, and <lang1> and <lang2> 174 // |autodetermined_source_language| is false, and <lang1> and <lang2>
175 // should be inverted (some languages express the sentense as "The page has 175 // should be inverted (some languages express the sentense as "The page has
176 // been translate to <lang2> from <lang1>."). It is ignored if 176 // been translate to <lang2> from <lang1>."). It is ignored if
177 // |autodetermined_source_language| is true. 177 // |autodetermined_source_language| is true.
178 static void GetAfterTranslateStrings(std::vector<string16>* strings, 178 static void GetAfterTranslateStrings(std::vector<string16>* strings,
179 bool* swap_languages, 179 bool* swap_languages,
180 bool autodetermined_source_language); 180 bool autodetermined_source_language);
181 181
182 protected: 182 protected:
183 TranslateInfoBarDelegate(InfoBarService* infobar_service, 183 TranslateInfoBarDelegate(Type infobar_type,
184 Type infobar_type,
185 TranslateInfoBarDelegate* old_delegate, 184 TranslateInfoBarDelegate* old_delegate,
186 const std::string& original_language, 185 const std::string& original_language,
187 const std::string& target_language, 186 const std::string& target_language,
188 TranslateErrors::Type error_type, 187 TranslateErrors::Type error_type,
189 PrefService* prefs, 188 PrefService* prefs,
190 ShortcutConfiguration shortcut_config); 189 ShortcutConfiguration shortcut_config);
191 190
192 private: 191 private:
192 friend class TranslationInfoBarTest;
193 typedef std::pair<std::string, string16> LanguageNamePair; 193 typedef std::pair<std::string, string16> LanguageNamePair;
194 194
195 // Returns a translate infobar that owns |delegate|.
196 static scoped_ptr<InfoBar> CreateInfoBar(
197 scoped_ptr<TranslateInfoBarDelegate> delegate);
198
195 // InfoBarDelegate: 199 // InfoBarDelegate:
196 virtual InfoBar* CreateInfoBar(InfoBarService* infobar_service) OVERRIDE;
197 virtual void InfoBarDismissed() OVERRIDE; 200 virtual void InfoBarDismissed() OVERRIDE;
198 virtual int GetIconID() const OVERRIDE; 201 virtual int GetIconID() const OVERRIDE;
199 virtual InfoBarDelegate::Type GetInfoBarType() const OVERRIDE; 202 virtual InfoBarDelegate::Type GetInfoBarType() const OVERRIDE;
200 virtual bool ShouldExpire( 203 virtual bool ShouldExpire(
201 const content::LoadCommittedDetails& details) const OVERRIDE; 204 const content::LoadCommittedDetails& details) const OVERRIDE;
202 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() OVERRIDE; 205 virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate() OVERRIDE;
203 206
204 Type infobar_type_; 207 Type infobar_type_;
205 208
206 // The type of fading animation if any that should be used when showing this 209 // The type of fading animation if any that should be used when showing this
(...skipping 14 matching lines...) Expand all
221 224
222 // The translation related preferences. 225 // The translation related preferences.
223 TranslatePrefs prefs_; 226 TranslatePrefs prefs_;
224 227
225 // Translation shortcut configuration 228 // Translation shortcut configuration
226 ShortcutConfiguration shortcut_config_; 229 ShortcutConfiguration shortcut_config_;
227 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); 230 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate);
228 }; 231 };
229 232
230 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ 233 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_browsertest.cc ('k') | chrome/browser/translate/translate_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698