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

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: (rebasing) 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..5345c825eedd16ad8bec39149495db3509cd92b3 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
+ // displayable name.
+ typedef std::pair<std::string, string16> LanguageNamePair;
+
TranslateUIDelegate(content::WebContents* web_contents,
const std::string& original_language,
const std::string& target_language);
virtual ~TranslateUIDelegate();
+ // Retrieves the displayable names of the supported languages, based on
+ // |locale|. The returned names are sorted in alphabetical order.
+ 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_;
« no previous file with comments | « chrome/browser/translate/translate_manager_browsertest.cc ('k') | chrome/browser/translate/translate_ui_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698