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

Unified Diff: chrome/browser/translate/translate_ui_delegate.h

Issue 64823005: Copy the implementations of TranslateUIDelegate to TransalteInfobarDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Peter's review Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/translate/translate_ui_delegate.h
diff --git a/chrome/browser/translate/translate_ui_delegate.h b/chrome/browser/translate/translate_ui_delegate.h
index 656b6d2310e0f9fc4a2310191a61a355961c9c36..253b866a788c8ce146198ac68d8fc45290c23850 100644
--- a/chrome/browser/translate/translate_ui_delegate.h
+++ b/chrome/browser/translate/translate_ui_delegate.h
@@ -21,17 +21,33 @@ class WebContents;
// The TranslateUIDelegate is a generic delegate for UI which offers Translate
// feature to the user.
+//
+// Note: TranslateInfobarDelegate should be updated if this implementation is
+// updated.
class TranslateUIDelegate {
public:
enum {
NO_INDEX = -1,
};
+ // A pair whose key is a language code and value is the language's
+ // displyayable name.
Peter Kasting 2013/11/12 00:03:27 Nit: This still has a typo
hajimehoshi 2013/11/12 03:07:25 Done.
+ typedef std::pair<std::string, string16> LanguageNamePair;
+
TranslateUIDelegate(content::WebContents* web_contents,
const std::string& original_language,
const std::string& target_language);
virtual ~TranslateUIDelegate();
+ // Returns the languages' displayable names, which are sorted in alphabetical
+ // order, according to |locale|.
Peter Kasting 2013/11/12 00:03:27 So does this mean that the displayable names are c
hajimehoshi 2013/11/12 03:07:25 Done.
+ static std::vector<LanguageNamePair> GetSortedLanguageNames(
+ const std::string& locale);
+
+ // Gets the host of the page of |web_contents|, or an empty string if no URL
+ // is associated with the current page.
+ static std::string GetPageHost(content::WebContents* web_contents);
+
content::WebContents* web_contents() { return web_contents_; }
// Returns the number of languages supported.
@@ -91,14 +107,8 @@ class TranslateUIDelegate {
void SetAlwaysTranslate(bool value);
private:
- // Gets the host of the page being translated, or an empty string if no URL is
- // associated with the current page.
- std::string GetPageHost();
-
content::WebContents* web_contents_;
- typedef std::pair<std::string, string16> LanguageNamePair;
-
// The list supported languages for translation.
// The pair first string is the language ISO code (ex: en, fr...), the second
// string is the displayable name on the current locale.
@@ -108,13 +118,6 @@ class TranslateUIDelegate {
// The index for language the page is originally in.
size_t original_language_index_;
- // The index for language the page is originally in that was originally
- // reported (original_language_index_ changes if the user selects a new
- // original language, but this one does not). This is necessary to report
- // language detection errors with the right original language even if the user
- // changed the original language.
- size_t initial_original_language_index_;
-
// The index for language the page should be translated to.
size_t target_language_index_;

Powered by Google App Engine
This is Rietveld 408576698