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

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

Issue 1185703007: Disable translate when there is no API key (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 5 years, 5 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
Index: components/translate/core/browser/translate_manager.h
diff --git a/components/translate/core/browser/translate_manager.h b/components/translate/core/browser/translate_manager.h
index 74abcca48d12944762a8170aa723d5d4182b7f82..057df12b66a56cd93143a794998a5dd445edcf61 100644
--- a/components/translate/core/browser/translate_manager.h
+++ b/components/translate/core/browser/translate_manager.h
@@ -99,6 +99,10 @@ class TranslateManager {
// Gets the LanguageState associated with the TranslateManager
LanguageState& GetLanguageState();
+ // By default, don't offer to translate in builds lacking an API key. For
+ // testing, set to true to offer anyway.
+ static void SetIgnoreMissingKeyForTesting(bool ignore);
+
private:
// Sends a translation request to the TranslateDriver.
void DoTranslatePage(const std::string& translate_script,
@@ -125,6 +129,10 @@ class TranslateManager {
base::WeakPtrFactory<TranslateManager> weak_method_factory_;
+ // By default, don't offer to translate in builds lacking an API key. For
+ // testing, set to true to offer anyway.
+ static bool ignore_missing_key_for_testing_;
+
DISALLOW_COPY_AND_ASSIGN(TranslateManager);
};

Powered by Google App Engine
This is Rietveld 408576698