Chromium Code Reviews| Index: components/translate/core/browser/translate_ui_delegate.h |
| diff --git a/components/translate/core/browser/translate_ui_delegate.h b/components/translate/core/browser/translate_ui_delegate.h |
| index 230a68cd6c973319c5dc5c44c80408990aae1294..7242830cf1fa65e92f7606fa50e64b8c6c7e1d2f 100644 |
| --- a/components/translate/core/browser/translate_ui_delegate.h |
| +++ b/components/translate/core/browser/translate_ui_delegate.h |
| @@ -77,6 +77,9 @@ class TranslateUIDelegate { |
| // Returns the ISO code for the language at |index|. |
| std::string GetLanguageCodeAt(size_t index) const; |
| + // Returns the index of |language_code|. |
| + size_t GetLanguageIndex(const std::string& language_code); |
| + |
| // Returns the displayable name for the language at |index|. |
| base::string16 GetLanguageNameAt(size_t index) const; |
| @@ -101,23 +104,49 @@ class TranslateUIDelegate { |
| // Returns true if the current language is blocked. |
| bool IsLanguageBlocked(); |
| + // Returns true if |language_code| is blocked. |
| + bool IsLanguageBlocked(const std::string& language_code); |
| + |
| // Sets the value if the current language is blocked. |
| void SetLanguageBlocked(bool value); |
| + // Sets the value if the |language_code| is blocked. |
| + void SetLanguageBlocked(bool value, const std::string& language_code); |
|
Hiroshi Ichikawa
2017/05/10 08:36:55
Optional: I slightly prefer the opposite order of
jzw1
2017/05/11 03:03:17
I kind of like this order since I'm overloading th
|
| + |
| // Returns true if the current webpage is blacklisted. |
| bool IsSiteBlacklisted(); |
| + // Returns true if |page_host| is blacklisted. |
| + bool IsSiteBlacklisted(const std::string& page_host); |
| + |
| // Sets the value if the current webpage is blacklisted. |
| void SetSiteBlacklist(bool value); |
| + // Sets the value if the |page_host| is blacklisted. |
| + void SetSiteBlacklist(bool value, const std::string& page_host); |
| + |
| // Returns true if the webpage in the current original language should be |
| // translated into the current target language automatically. |
| bool ShouldAlwaysTranslate(); |
| + // Returns true if the webpage in the |from_language| should be |
| + // translated into the |to_language| automatically. |
| + bool ShouldAlwaysTranslate(const std::string& from_language, |
|
Hiroshi Ichikawa
2017/05/10 08:36:55
Is this method used? Looks sufficient with only Ge
jzw1
2017/05/11 03:03:17
Done.
|
| + const std::string& to_language); |
| + |
| // Sets the value if the webpage in the current original language should be |
| // translated into the current target language automatically. |
| void SetAlwaysTranslate(bool value); |
| + // Sets the value if the webpage in the |from_language| should be |
| + // translated into the |to_language| automatically. |
| + void SetAlwaysTranslate(bool value, |
|
Hiroshi Ichikawa
2017/05/10 08:36:55
This API looks a bit weird. This API seems to indi
jzw1
2017/05/11 03:03:17
Wouldn't you still be able to do something like:
E
Hiroshi Ichikawa
2017/05/11 04:14:15
My point is rather that having a boolean parameter
jzw1
2017/05/11 04:42:59
I'll just update the comment.
|
| + const std::string& from_language, |
| + const std::string& to_language); |
| + |
| + // Returns the language to always translate |from_language| to. |
|
Hiroshi Ichikawa
2017/05/10 08:36:55
Can you document the return value in case |from_la
jzw1
2017/05/11 03:03:17
Done.
|
| + std::string GetAlwaysTranslateToLanguage(const std::string& from_language); |
| + |
| // Returns true if the Always Translate checkbox should be checked by default. |
| bool ShouldAlwaysTranslateBeCheckedByDefault(); |