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

Unified Diff: components/translate/core/browser/translate_ui_delegate.h

Issue 2872083003: Added translation policy API. (Closed)
Patch Set: addressed ichikawa comments part 2 Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/translate/core/browser/translate_ui_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..55f7c2bb1900b47ba7ce9d0e8cbae685a4a04492 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,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);
+
// 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);
+
// 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();
@@ -118,6 +133,18 @@ class TranslateUIDelegate {
// translated into the current target language automatically.
void SetAlwaysTranslate(bool value);
+ // Sets the value if the webpage in the |from_language| should be
Hiroshi Ichikawa 2017/05/11 04:59:44 Optional: Thanks, it's clearer now. But I feel the
jzw1 2017/05/11 07:23:46 Done.
+ // translated into the |to_language| automatically. Every |from_language| will
+ // only store the last |to_language| as the target. |to_language| is ignored
+ // when |value| is false.
+ 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();
« no previous file with comments | « no previous file | components/translate/core/browser/translate_ui_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698