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

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

Issue 286973003: Remove dependency of TranslateInfobarDelegate on profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
tfarina 2014/05/15 17:43:38 I'd not touch old copyright headers.
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/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/translate/translate_tab_helper.h"
15 #include "components/infobars/core/infobar_delegate.h" 14 #include "components/infobars/core/infobar_delegate.h"
16 #include "components/translate/core/browser/translate_prefs.h" 15 #include "components/translate/core/browser/translate_prefs.h"
16 #include "components/translate/core/browser/translate_step.h"
17 #include "components/translate/core/browser/translate_ui_delegate.h" 17 #include "components/translate/core/browser/translate_ui_delegate.h"
18 #include "components/translate/core/common/translate_constants.h" 18 #include "components/translate/core/common/translate_constants.h"
19 #include "components/translate/core/common/translate_errors.h" 19 #include "components/translate/core/common/translate_errors.h"
20 20
21 class PrefService; 21 class PrefService;
22 22
23 namespace content {
24 class WebContents;
25 }
26
23 class TranslateInfoBarDelegate : public infobars::InfoBarDelegate { 27 class TranslateInfoBarDelegate : public infobars::InfoBarDelegate {
24 public: 28 public:
25 // The types of background color animations. 29 // The types of background color animations.
26 enum BackgroundAnimationType { 30 enum BackgroundAnimationType {
27 NONE, 31 NONE,
28 NORMAL_TO_ERROR, 32 NORMAL_TO_ERROR,
29 ERROR_TO_NORMAL 33 ERROR_TO_NORMAL
30 }; 34 };
31 35
32 static const size_t kNoIndex; 36 static const size_t kNoIndex;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // an extra shortcut to let the user black-list/white-list that language 144 // an extra shortcut to let the user black-list/white-list that language
141 // (based on how many times the user accepted/declined translation). 145 // (based on how many times the user accepted/declined translation).
142 // The shortcut itself is platform specific, it can be a button or a new bar 146 // The shortcut itself is platform specific, it can be a button or a new bar
143 // for example. 147 // for example.
144 bool ShouldShowNeverTranslateShortcut(); 148 bool ShouldShowNeverTranslateShortcut();
145 bool ShouldShowAlwaysTranslateShortcut(); 149 bool ShouldShowAlwaysTranslateShortcut();
146 150
147 // Returns the WebContents associated with the TranslateInfoBarDelegate. 151 // Returns the WebContents associated with the TranslateInfoBarDelegate.
148 content::WebContents* GetWebContents(); 152 content::WebContents* GetWebContents();
149 153
150 // Convenience method that returns the displayable language name for
151 // |language_code| in the current application locale.
152 static base::string16 GetLanguageDisplayableName(
153 const std::string& language_code);
154
155 // Adds the strings that should be displayed in the after translate infobar to 154 // Adds the strings that should be displayed in the after translate infobar to
156 // |strings|. If |autodetermined_source_language| is false, the text in that 155 // |strings|. If |autodetermined_source_language| is false, the text in that
157 // infobar is: 156 // infobar is:
158 // "The page has been translated from <lang1> to <lang2>." 157 // "The page has been translated from <lang1> to <lang2>."
159 // Otherwise: 158 // Otherwise:
160 // "The page has been translated to <lang1>." 159 // "The page has been translated to <lang1>."
161 // Because <lang1>, or <lang1> and <lang2> are displayed in menu buttons, the 160 // Because <lang1>, or <lang1> and <lang2> are displayed in menu buttons, the
162 // text is split in 2 or 3 chunks. |swap_languages| is set to true if 161 // text is split in 2 or 3 chunks. |swap_languages| is set to true if
163 // |autodetermined_source_language| is false, and <lang1> and <lang2> 162 // |autodetermined_source_language| is false, and <lang1> and <lang2>
164 // should be inverted (some languages express the sentense as "The page has 163 // should be inverted (some languages express the sentense as "The page has
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // The translation related preferences. 206 // The translation related preferences.
208 scoped_ptr<TranslatePrefs> prefs_; 207 scoped_ptr<TranslatePrefs> prefs_;
209 208
210 // Whether the translation was triggered via a menu click vs automatically 209 // Whether the translation was triggered via a menu click vs automatically
211 // (due to language detection, preferences...) 210 // (due to language detection, preferences...)
212 bool triggered_from_menu_; 211 bool triggered_from_menu_;
213 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); 212 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate);
214 }; 213 };
215 214
216 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_ 215 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698