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..90d2607cce339b80d0c8d41a4cf31cccd536e321 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); |
|
michaeldo
2017/05/11 23:51:33
Should this be avoided per comment above about crb
jzw1
2017/05/12 03:46:46
I think it's mainly concerned with updating langua
|
| + |
| // Returns the displayable name for the language at |index|. |
| base::string16 GetLanguageNameAt(size_t index) const; |
| @@ -101,15 +104,27 @@ 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); |
|
Eugene But (OOO till 7-30)
2017/05/11 15:48:59
Please document if strings can be empty and what h
jzw1
2017/05/12 03:46:45
Do you mean string.empty() or null? I updated the
Hiroshi Ichikawa
2017/05/12 06:06:06
I believe he means string.empty(). It will be a co
|
| + |
| // Sets the value if the current language is blocked. |
| void SetLanguageBlocked(bool value); |
| + // Sets the value if the |language_code| is blocked. |
|
Eugene But (OOO till 7-30)
2017/05/11 15:48:59
This method unconditionally sets the value, not on
jzw1
2017/05/12 03:46:46
Updated comments to be more clear.
|
| + void SetLanguageBlocked(bool value, const std::string& language_code); |
| + |
| // 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. |
|
Eugene But (OOO till 7-30)
2017/05/11 15:48:59
ditto
jzw1
2017/05/12 03:46:45
Done.
|
| + 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(); |
| @@ -118,6 +133,20 @@ class TranslateUIDelegate { |
| // translated into the current target language automatically. |
| void SetAlwaysTranslate(bool value); |
| + // If |value| is true, update the preference to always translate |
|
Eugene But (OOO till 7-30)
2017/05/11 15:48:59
s/update/updates
jzw1
2017/05/12 03:46:45
Done and did same for below.
|
| + // |from_language| to |to_language| without prompting. If it is called |
| + // multiple times for the same |from_language|, the last specified |
| + // |to_language| is used. |
| + // If |value| is false, update the preference not to always translate |
| + // |from_language|. |target_language| is ignored. |
| + void SetAlwaysTranslate(bool value, |
| + const std::string& from_language, |
| + const std::string& to_language); |
| + |
| + // Returns the language to always translate |from_language| to, or empty |
| + // string if no such language has been set. |
| + std::string GetAlwaysTranslateToLanguage(const std::string& from_language); |
| + |
| // Returns true if the Always Translate checkbox should be checked by default. |
| bool ShouldAlwaysTranslateBeCheckedByDefault(); |